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 details of interactions between notifications and loops #597
base: devel
Are you sure you want to change the base?
Conversation
This clarifies behaviour raised in ansible/ansible#81950 and ansible/ansible#77550 as expected and documented.
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 left some initial feedback. Thanks for the contribution!
@lod, are you still interested in proceeding with this PR? |
Co-authored-by: Maxwell G <maxwell@gtmx.me>
@gotmax23 - i committed your suggested edits. Can you take another look and approve the PR if you agree? |
state: restarted | ||
|
||
Note that the handlers are triggered if the task as a whole is changed, for loops that is if any loop item changes. | ||
In the above example both memcached and apache will be restarted if either template file is changed, neither will be restarted if no file changes. |
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.
Since this behavior is pretty surprising (at least to me, and apparently also to the folks who created the issues in ansible/ansible) I would suggest moving this paragraph before the example, so that you read this before looking at the example. Right now when starting to read this new section, I might just look at the first paragraph and then at the example and then stop, getting the completely wrong impression of what is happening.
ansible.builtin.template: | ||
src: "{{ item }}.j2" | ||
dest: /etc/systemd/system/{{ item }}.service | ||
notify: Restart {{ item }} |
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 would also add a comment inside the example, like this:
notify: Restart {{ item }} | |
# Note: if *any* loop iteration triggers a change, *all* handlers | |
# for this loop are run! | |
notify: Restart {{ item }} |
This clarifies behaviour raised in ansible/ansible#81950 and ansible/ansible#77550 as expected and documented.