Skip to content

Commit

Permalink
Add alternative authenticated module task
Browse files Browse the repository at this point in the history
  • Loading branch information
BillAnastasiadis committed Nov 15, 2024
1 parent 694343f commit b99f90a
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions ansible/playbooks/registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,11 @@
# Is registercloudguest available?
# only run it if:
# - there's at least one 'Not Registered' module
# - the user does not require only use SUSEConnect with `use_suseconnect`
- name: Check for registercloudguest
ansible.builtin.command: which registercloudguest
register: is_registercloudguest_bin
failed_when: false
changed_when: false
when:
- not_registered_found
- not use_suseconnect | bool

# Execute Section

Expand Down Expand Up @@ -123,14 +119,29 @@
when:
- sles_modules is defined and sles_modules | length > 0

- name: Add additional authenticated modules
- name: Add additional authenticated modules [SUSEConnnect]
ansible.builtin.command: SUSEConnect -p {{ item.key }} -r {{ item.value }}
register: result
until: result is succeeded
retries: 10
delay: 60
when:
- sles_modules is defined and sles_modules | length > 0
- "(is_registercloudguest_bin.rc != 0) or (use_suseconnect | bool)"
loop: "{{ sles_modules }}"
loop_control:
label: "{{ item.key }}"

- name: Add additional authenticated modules [registercloudguest]
ansible.builtin.command: registercloudguest -r {{ item.value }}
register: result
until: result is succeeded
retries: 10
delay: 60
when:
- sles_modules is defined and sles_modules | length > 0
- is_registercloudguest_bin.rc == 0
- not use_suseconnect | bool
loop: "{{ sles_modules }}"
loop_control:
label: "{{ item.key }}"
Expand Down

0 comments on commit b99f90a

Please sign in to comment.