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 details of interactions between notifications and loops #597

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

lod
Copy link

@lod lod commented Oct 12, 2023

This clarifies behaviour raised in ansible/ansible#81950 and ansible/ansible#77550 as expected and documented.

This clarifies behaviour raised in ansible/ansible#81950 and ansible/ansible#77550 as expected and documented.
@github-actions github-actions bot added the needs_triage Needs a first human triage before being processed. label Oct 12, 2023
@gotmax23 gotmax23 added the new_contributor This PR is the first contribution by a new community member. label Oct 13, 2023
Copy link
Collaborator

@gotmax23 gotmax23 left a 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!

@gotmax23 gotmax23 added backport-2.15 Automatically create a backport for the stable-2.15 branch backport-2.14 Automatically create a backport for the stable-2.14 branch backport-2.16 Automatically create a backport for the stable-2.16 branch labels Oct 13, 2023
@gotmax23 gotmax23 added the needs_info requesting more detail from OP label Nov 24, 2023
@gotmax23
Copy link
Collaborator

@lod, are you still interested in proceeding with this PR?

Co-authored-by: Maxwell G <maxwell@gtmx.me>
@samccann samccann removed needs_info requesting more detail from OP needs_triage Needs a first human triage before being processed. labels Jan 18, 2024
@samccann
Copy link
Contributor

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

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 }}
Copy link
Collaborator

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:

Suggested change
notify: Restart {{ item }}
# Note: if *any* loop iteration triggers a change, *all* handlers
# for this loop are run!
notify: Restart {{ item }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-2.14 Automatically create a backport for the stable-2.14 branch backport-2.15 Automatically create a backport for the stable-2.15 branch backport-2.16 Automatically create a backport for the stable-2.16 branch new_contributor This PR is the first contribution by a new community member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants