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 0d684f7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ansible/playbooks/registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@
- not_registered_found
- "(rcg.rc != 0) or (use_suseconnect | bool)"

- 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:
- ansible_facts['distribution_major_version'] == "12"
- 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
10 changes: 10 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,15 @@ 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 to add any number of additional modules that require a regcode during execution of registration.yaml playbook. The module names and regcodes are injected in the command that calls the playbook an argument with the form of a list of hashes (named sles_modules), either if the playbook is ran standalone, or if it is run through the config.yaml file.

The format should be like this:

```
create:
- registration.yaml (.......other variables here......) -e sles_modules='[{"key":"<module_to_activate","value":"<regcode-for-module>"}]'
```

## pre-cluster

Target hosts:
Expand Down

0 comments on commit 0d684f7

Please sign in to comment.