ansible: Check for SLES product using major version
authorKienan Stewart <kstewart@efficios.com>
Wed, 14 Feb 2024 20:40:22 +0000 (15:40 -0500)
committerKienan Stewart <kstewart@efficios.com>
Wed, 14 Feb 2024 20:50:44 +0000 (15:50 -0500)
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 <kstewart@efficios.com>
automation/ansible/roles/docker/tasks/setup-Suse.yml
automation/ansible/roles/suse/tasks/product.yml [new file with mode: 0644]

index a2372f32b72aa2747d86030ca40b361bddbc3fb6..5fafa927419487ccb30db466e91a15abba02df36 100644 (file)
@@ -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 (file)
index 0000000..0847a6c
--- /dev/null
@@ -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}}"]
This page took 0.02425 seconds and 4 git commands to generate.