-
Notifications
You must be signed in to change notification settings - Fork 59
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
sap_general_preconfigure: Use tags for limiting the role scope #653
Conversation
... for limiting the role scope. Relates to sap-linuxlab#342. Sample playbook calls: $ ansible-playbook sap.yml --tags \ sap_general_preconfigure_configuration,sap_general_preconfigure_configuration_all_steps $ ansible-playbook sap.yml --tags \ sap_general_preconfigure_configuration,sap_general_preconfigure_2772999_02 $ ansible-playbook sap.yml --tags \ sap_general_preconfigure_configuration,sap_general_preconfigure_selinux $ ansible-playbook sap.yml --tags \ sap_general_preconfigure_configuration,sap_general_preconfigure_configuration_all_steps \ --skip-tags sap_general_preconfigure_2772999_02 $ ansible-playbook sap.yml --tags \ sap_general_preconfigure_configuration,sap_general_preconfigure_configuration_all_steps \ --skip-tags sap_general_preconfigure_selinux Signed-off-by: Bernd Finger <[email protected]>
Part of sap-linuxlab#342. Signed-off-by: Bernd Finger <[email protected]>
Solves sap-linuxlab#342. Signed-off-by: Bernd Finger <[email protected]>
Relates to sap-linuxlab#342. Signed-off-by: Bernd Finger <[email protected]>
Relates to: sap-linuxlab#342. Signed-off-by: Bernd Finger <[email protected]>
with_items: "{{ __sap_general_preconfigure_sapnotes_versions | difference(['']) }}" | ||
loop_control: | ||
loop_var: sap_note_line_item | ||
tags: | ||
- sap_general_preconfigure_configuration | ||
- sap_general_preconfigure_configuration_all_steps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the tag sap_general_preconfigure_configuration_all_steps
really necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the tag
sap_general_preconfigure_configuration_all_steps
really necessary?
Thanks! I tested again and it found no longer a combination of tags which would require both tags. So it seems it's really not required. I'll update the code accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit too fast. Further testing revealed that only with both tags, sap_general_preconfigure_configuration
and sap_general_preconfigure_configuration_all_steps
, it is possible to execute just one or a few of the configuration steps.
With just the tag sap_general_preconfigure_configuration
, it is possible to run all configuration steps and skip some of them. But I want more. ;-)
See also the examples in README.md.
ansible.builtin.include_tasks: | ||
file: '{{ item }}/{{ __sap_general_preconfigure_fact_assert_filename_prefix }}installation.yml' | ||
apply: | ||
tags: sap_general_preconfigure_installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a tag in this task, why adding the same one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code will apply a tag to all tasks of the included file(s). And without the tags:
lines at the end of the same task, this current task will not be run when using that tag. See also: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/include_tasks_module.html .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ansible.builtin.include_tasks: | ||
file: '{{ item }}/{{ __sap_general_preconfigure_fact_assert_filename_prefix }}configuration.yml' | ||
apply: | ||
tags: sap_general_preconfigure_configuration_all_steps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question done in the line 102
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me and really improve usability
ansible.builtin.include_tasks: | ||
file: '{{ item }}/{{ __sap_general_preconfigure_fact_assert_filename_prefix }}installation.yml' | ||
apply: | ||
tags: sap_general_preconfigure_installation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
After discussing an alternative solution with a colleague (for avoiding two parameters when running all or most configuration steps), I will test another approach. Moving to draft now. |
…ion steps Examples for using tags: See README.md. Relates to: sap-linuxlab#342. Signed-off-by: Bernd Finger <[email protected]>
This version is now easier to use and eliminates the need for specifying two tags when running all configuration steps. The only little disadvantage is that now, when using the tag |
LGTM. This PR is a really cool improvement. |
roles/sap_general_preconfigure/tasks/sapnote/assert-2772999.yml
Outdated
Show resolved
Hide resolved
Relates to issue sap-linuxlab#342. Signed-off-by: Bernd Finger <[email protected]>
relates to issue sap-linuxlab#342 Signed-off-by: Bernd Finger <[email protected]>
Relates to issue sap-linuxlab#342 Signed-off-by: Bernd Finger <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff. 👍
Please see the updates of the
README.md
file for examples for using tags with this role (currently only for RHEL systems).Solves #342 but leaves the related role parameters (e.g.
sap_general_preconfigure_configuration
,sap_general_preconfigure_2772999_02
) in place and functional because no deprecation note has been published yet.