Add Register variables for Repositories role #2
ikeusmaximus
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are looking to expand the functionality of our internal role to notify a handler for the content syncing tasks (e.g.):
The tasks for enabling the repositories, we are leveraging straight out of the documentation for defining the variables:
https://github.com/RedHatSatellite/satellite-ansible-collection/blob/develop/roles/repositories/README.md
Then we simply include/import the role:
We can add/remove repositories via code, and when we add new ones, we would like to notify the handler to do an immediate sync of content.
Based on Ansible documentation:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/include_role_module.html
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/import_role_module.html
"To apply keywords to the tasks within the role, pass them using the apply option or use ansible.builtin.import_role instead."
Per https://docs.ansible.com/ansible/latest/reference_appendices/playbooks_keywords.html
"register" is a valid ansible keyword, yet when trying various combinations of import/include and:
The task outputs are not being captured properly if they don't throw an error ("Register is not a valid attribute for Block"). Debugging only says "VARIABLE NOT DEFINED"
I am fairly certain this is a limitation of ansible because the following code compiles/lints, runs, and the
no_log
functionality is correctly applied:So to start the actual discussion, thoughts on adding
register: <variable_name>
to the tasks contained within theredhat.satellite.repositories
role?Additional things to consider:
Beta Was this translation helpful? Give feedback.
All reactions