Skip to content

Commit

Permalink
Add support for additional module registration
Browse files Browse the repository at this point in the history
  • Loading branch information
BillAnastasiadis committed Nov 6, 2024
1 parent 354016c commit d937323
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
25 changes: 25 additions & 0 deletions ansible/playbooks/registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,31 @@
- not_registered_found
- "(rcg.rc != 0) or (use_suseconnect | bool)"

# Latest version of cloud-regionsrv-client is needed in PAYG, and image
# needs to be registered in order for zypper up to work.
# see https://www.suse.com/c/long-term-service-pack-support-for-payg-instances-simplified/
- name: Ensure cloud-regionsrv-client is on latest version.
community.general.zypper:
name: cloud-regionsrv-client
state: latest
when:
- ansible_facts['distribution_major_version'] == "12"
- not not_registered_found
- sles_modules is defined and sles_modules | length > 0

- name: Add additional authenticated modules
ansible.builtin.command: SUSEConnect -p {{ item.key }} -r {{ item.value }}
register: result
until: result is succeeded
retries: 10
delay: 60
when:
- not_registered_found
- sles_modules is defined and sles_modules | length > 0
loop: "{{ sles_modules }}"
loop_control:
label: "{{ item.key }}"

- name: Check if repos are added after registration
ansible.builtin.command: zypper lr -u
register: repos_after
Expand Down
12 changes: 12 additions & 0 deletions docs/playbooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Variables:

* reg_code
* email_address
* sles_modules

Variable Source = ./variables.sh

Expand All @@ -46,6 +47,17 @@ using `registercloudguest`. If the command is available, it will be used for
registration. If `registercloudguest` is not available then `SUSEConnect` will
be used.


There's a task allowing register additional modules that require a dedicated regcode.
The module names and regcodes can be provided in the `ansible-playbook` command line as list of hashes (named sles_modules).

The format should be like this:

```
create:
- registration.yaml (.......other variables here......) -e sles_modules='[{"key":"<module1>","value":"<regcode1>"},{"key":"<module2","value":"<regcode2>"}]'
```

## pre-cluster

Target hosts:
Expand Down

0 comments on commit d937323

Please sign in to comment.