Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for additional module registration #289

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions ansible/playbooks/registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,30 @@
- 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.
mpagot marked this conversation as resolved.
Show resolved Hide resolved
community.general.zypper:
name: cloud-regionsrv-client
state: latest
when:
- not not_registered_found
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this one deserve an explanation:

  • The article suggest to update cloud-regionsrv-client for 12sp5 PAYG
  • zypper up only works if image is registered

- 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
Loading