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

How to avoid handler name clashes across roles in the same play. #223

Open
NeilDavisNPS opened this issue Jul 22, 2024 · 1 comment
Open
Assignees
Labels
question Further information is requested

Comments

@NeilDavisNPS
Copy link

Question
This is a question about usage, and possibly style in respect of plays within a playbook.
One of the tasks in the post section of the role, is the following:

  • name: Flush handlers
    ansible.builtin.meta: flush_handlers
    This ,if I have understood the description, causes all handlers in a play that have a notify set to be actioned.. irrespective of the role in which the handler is defined. I tripped over having a user defined handler with one of the same name as in the rhel9 role ( "Restart sshd"), so it ran before the other role itself had run causing the play to fail.

Is it "good form" to run the rhel9cis role in it's own play? Is there a clean way to namespace the tasks so that they do not clash?

Environment (please complete the following information):

  • Ansible Version: [2.16.9]
  • Host Python Version: [3.11 ]
  • Ansible Server Python Version: [3.9]
  • Additional Details:
@NeilDavisNPS NeilDavisNPS added the question Further information is requested label Jul 22, 2024
@uk-bolly
Copy link
Member

hi @NeilDavisNPS

Great question, As you have mentioned i would suggest the same, to run it as its own play or the order in which you run your roles.
Due to the number of changes/tasks in these roles and the way the vendors give updates, i would run these individually unless you are able to keep on top of the changes as part of your solution.

Kindest regards

uk-bolly

@uk-bolly uk-bolly self-assigned this Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants