From: Kienan Stewart Date: Wed, 14 Feb 2024 20:40:22 +0000 (-0500) Subject: ansible: Check for SLES product using major version X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a56cba0719d220435a4b4afaca6339e808643f7d;p=lttng-ci.git ansible: Check for SLES product using major version docker is provided by the `sle-module-containers/12/x86_64` not `sle-module-containers/12.5/x86_64` on SLES12 SP5. Change-Id: Id4c2596f0954839ca8baaf0be8661c09790a8774 Signed-off-by: Kienan Stewart --- diff --git a/automation/ansible/roles/docker/tasks/setup-Suse.yml b/automation/ansible/roles/docker/tasks/setup-Suse.yml index a2372f3..5fafa92 100644 --- a/automation/ansible/roles/docker/tasks/setup-Suse.yml +++ b/automation/ansible/roles/docker/tasks/setup-Suse.yml @@ -2,8 +2,9 @@ - name: Add SLES products when: ansible_distribution == 'SLES' - ansible.builtin.command: - argv: ['suseconnect', '-p', "{{product}}/{{ansible_distribution_version}}/{{ansible_architecture}}"] + include_role: + name: suse + tasks_from: product loop: "{{docker_sles_products|default([])}}" loop_control: loop_var: product diff --git a/automation/ansible/roles/suse/tasks/product.yml b/automation/ansible/roles/suse/tasks/product.yml new file mode 100644 index 0000000..0847a6c --- /dev/null +++ b/automation/ansible/roles/suse/tasks/product.yml @@ -0,0 +1,12 @@ +--- + +- name: Connect product using full version + ansible.builtin.command: + argv: ['suseconnect', '-p', "{{product}}/{{ansible_distribution_version}}/{{ansible_architecture}}"] + register: connect + ignore_errors: true +# Some products don't use the full version, but only the major version +- name: Connect production using major version + when: connect.rc != 0 + ansible.builtin.command: + argv: ['suseconnect', '-p', "{{product}}/{{ansible_distribution_major_version}}/{{ansible_architecture}}"]