From 0d639aabc177526f9e1c538f11eaa5ead099cfba Mon Sep 17 00:00:00 2001 From: Michele Pagot Date: Fri, 20 Dec 2024 21:32:16 +0100 Subject: [PATCH] Add workaround for bug bsc#1217583 (#306) * Add workaround for bug bsc#1217583 Only in 15sp2, temporary force registration with SUSEConnect to avoid failing registercloudguest with IPv6, due to old cloud-regionsrv-client package version included in the image. * Fix some Ansible lint errors --- ansible/playbooks/registration.yaml | 38 ++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/ansible/playbooks/registration.yaml b/ansible/playbooks/registration.yaml index b0dd4fe..b21636c 100644 --- a/ansible/playbooks/registration.yaml +++ b/ansible/playbooks/registration.yaml @@ -26,7 +26,6 @@ - name: Check for 'Not Registered' ansible.builtin.set_fact: not_registered_found: "{{ 'Not Registered' in repos.stdout }}" - ignore_errors: true # Is registercloudguest available? # only run it if: @@ -37,6 +36,36 @@ failed_when: false changed_when: false + # Next four tasks are about bug bsc 1217583. This bug is already fixed + # in cloud-regionsrv-client 10.1.7, but SLES 15SP2 does not have it in + # the image, only get it after an update. But, at least for BYOS images, + # update is not possible with registercloudguest, due to the bug itself. + # Workaround is to force registration with SUSEConnect + - name: Gather the package facts to check cloud-regionsrv-client in 15sp2 + ansible.builtin.package_facts: + manager: auto + when: + - ansible_facts['distribution_version'] == '15.2' + - not use_suseconnect | bool + + - name: Softfail for old cloud-regionsrv-client in 15sp2 + ansible.builtin.debug: + msg: + - "[OSADO][softfail] bsc#1217583 IPv6 handling during registration" + - "use_suseconnect: {{ use_suseconnect }}" + when: + - ansible_facts['distribution_version'] == '15.2' + - ansible_facts.packages['cloud-regionsrv-client'][0].version is version('10.1.7', '<') + - not use_suseconnect | bool + + - name: Force SUSEConnect usage in case of old cloud-regionsrv-client avoiding 1217583 + ansible.builtin.set_fact: + use_suseconnect: true + when: + - ansible_facts['distribution_version'] == '15.2' + - ansible_facts.packages['cloud-regionsrv-client'][0].version is version('10.1.7', '<') + - not use_suseconnect | bool + # Execute Section - name: Validate reg code ansible.builtin.assert: @@ -70,6 +99,7 @@ retries: 10 delay: 60 failed_when: result.rc != 0 or result.stderr != "" + changed_when: result.rc == 0 when: - not_registered_found - is_registercloudguest_bin.rc == 0 @@ -82,6 +112,7 @@ - name: SUSEConnect registration ansible.builtin.command: SUSEConnect -r "{{ reg_code }}" -e "{{ email_address }}" register: result + changed_when: result.rc == 0 until: result is succeeded retries: 10 delay: 60 @@ -94,6 +125,7 @@ - name: Add SLES 12 Advanced Systems Modules ansible.builtin.command: SUSEConnect -p sle-module-adv-systems-management/12/{{ ansible_facts['architecture'] }} -r "{{ reg_code }}" register: result + changed_when: result.rc == 0 until: result is succeeded retries: 10 delay: 60 @@ -103,6 +135,7 @@ - name: Add SLES 12 public cloud module ansible.builtin.command: SUSEConnect -p sle-module-public-cloud/12/{{ ansible_facts['architecture'] }} register: result + changed_when: result.rc == 0 until: result is succeeded retries: 10 delay: 60 @@ -114,6 +147,7 @@ - name: Add SLES 15 public cloud module ansible.builtin.command: SUSEConnect -p sle-module-public-cloud/{{ ansible_facts['distribution_version'] }}/{{ ansible_facts['architecture'] }} register: result + changed_when: result.rc == 0 until: result is succeeded retries: 10 delay: 60 @@ -135,6 +169,7 @@ - name: Add additional authenticated modules [SUSEConnnect] ansible.builtin.command: SUSEConnect -p {{ item.key }} -r {{ item.value }} register: result + changed_when: result.rc == 0 until: result is succeeded retries: 10 delay: 60 @@ -148,6 +183,7 @@ - name: Add additional authenticated modules [registercloudguest] ansible.builtin.command: registercloudguest -r {{ item.value }} register: result + changed_when: result.rc == 0 until: result is succeeded retries: 10 delay: 60