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

Conversation

BillAnastasiadis
Copy link
Collaborator

@BillAnastasiadis BillAnastasiadis commented Nov 5, 2024

This adds 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 as arguments, 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>"}]'

or without the create part if running playbook directly.

I tried 2 manual deployments, one with use_suseconnect=true and one without it, and ran ansible (containing only registration module).
I put this in config.yaml, in the line calling the registration.yaml file :

create:
    - registration.yaml -e reg_code=...-e email_address='' -e sles_modules='[{"key":"(...LTSS module name)","value":"(ltss regcode)"}]'
  • first case, general registration done with SUSEConnect, then new task also ran with suseconnect, after the playbook LTSS is activated.
  • second case, general registration done with registercloudguest, new task ran with SUSEConnect, after the playbook LTSS is activated.

Used: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html#iterating-over-a-list-of-hashes (added a label as proposed in https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_loops.html#limiting-loop-output-with-label, not sure if we need it in our case)

@BillAnastasiadis BillAnastasiadis force-pushed the ltss branch 5 times, most recently from b609420 to f32e13c Compare November 6, 2024 12:49
@BillAnastasiadis BillAnastasiadis changed the title WIP: Add support for additional module registration Add support for additional module registration Nov 6, 2024
@mpagot
Copy link
Collaborator

mpagot commented Nov 6, 2024

Please document the new variable in https://github.com/SUSE/qe-sap-deployment/tree/main/docs/playbooks

Copy link
Collaborator

@lpalovsky lpalovsky left a comment

Choose a reason for hiding this comment

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

LGTM

retries: 10
delay: 60
when:
- ansible_facts['distribution_major_version'] == "12"
Copy link
Collaborator

Choose a reason for hiding this comment

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

leave out

- ansible_facts['distribution_major_version'] == "12"

the task is generic for any kind of SCC channels. Our handling of LTSS is specific for 12sp5 but Ansible Task code is totally agnostic
about it

@@ -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.
Copy link
Collaborator

@mpagot mpagot Nov 6, 2024

Choose a reason for hiding this comment

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

Suggested change
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.
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).


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

@mpagot mpagot Nov 6, 2024

Choose a reason for hiding this comment

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

can you change example using 2 modules? Is it

-e sles_modules='[{"key":"<module_to_activate_1>","value":"<regcode_for_module_1>"}, {"key":"<module_to_activate_2>","value":"<regcode_for_module_2>"}]'

@BillAnastasiadis BillAnastasiadis force-pushed the ltss branch 2 times, most recently from b853307 to 02e15a3 Compare November 6, 2024 16:10
Copy link
Collaborator

@mpagot mpagot left a comment

Choose a reason for hiding this comment

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

LGTM

state: latest
when:
- ansible_facts['distribution_major_version'] == "12"
- 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

@BillAnastasiadis BillAnastasiadis force-pushed the ltss branch 3 times, most recently from d937323 to cce9747 Compare November 6, 2024 16:29
Copy link
Collaborator

@alvarocarvajald alvarocarvajald left a comment

Choose a reason for hiding this comment

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

LGTM. Just a question/suggestion/comment.

name: cloud-regionsrv-client
state: latest
when:
- ansible_facts['distribution_major_version'] == "12"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this line can be removed. Even though we're working on enabling LTSS/LTSS-ES in 12-SP5, updating this package should work in all supported Service Packs.

Copy link
Collaborator

@mpagot mpagot left a comment

Choose a reason for hiding this comment

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

LGTM

@mpagot mpagot merged commit a752147 into SUSE:main Nov 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants