Skip to content

Commit

Permalink
If registration is needed check that reg_code is provided
Browse files Browse the repository at this point in the history
Also fix some Ansible lint warning in th eregister playbook.
  • Loading branch information
mpagot committed Nov 28, 2024
1 parent c9d30e6 commit e2eb38d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ansible/playbooks/registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,26 @@
changed_when: false

# Execute Section
- name: Validate reg code
ansible.builtin.assert:
that:
- reg_code | length > 0
fail_msg: "'reg_code' must not be empty"
success_msg: "'reg_code' is OK"
changed_when: false
when:
- not_registered_found
- is_registercloudguest_bin.rc == 0
- not use_suseconnect | bool

# Start by pre-cleaning all. Only run it if:
# - the registercloudguest binary is available
# - there's at least one 'Not Registered' module
# - the user does not require only use SUSEConnect with 'use_suseconnect'
- name: Pre-run cleaning registercloudguest
ansible.builtin.command: registercloudguest --clean
register: cleanout
changed_when: cleanout.rc == 0
when:
- not_registered_found
- is_registercloudguest_bin.rc == 0
Expand Down

0 comments on commit e2eb38d

Please sign in to comment.