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

run_once not working as expected with handlers #12972

Closed
ianunruh opened this issue Oct 30, 2015 · 2 comments
Closed

run_once not working as expected with handlers #12972

ianunruh opened this issue Oct 30, 2015 · 2 comments
Labels
bug This issue/PR relates to a bug.
Milestone

Comments

@ianunruh
Copy link

Issue Type:

Bug Report

Ansible Version:

ansible 2.0.0 (479cbfc)

Ansible Configuration:

N/A

Environment:

OS X Yosemite / Python 2.7.10

Summary:

When using a handler with run_once: yes, multiple notifications trigger the handler to run multiple times. This differs from the behavior in Ansible 1.9.x, where run_once would only cause the handler to run once.

Steps To Reproduce:

- hosts: all
  tasks:
    - name: run a command
      command: ls
      notify:
        - run another command

  handlers:
    - name: run another command
      run_once: yes
      command: ls
ansible-playbook test.yml

Expected Results:

PLAY ***************************************************************************

TASK [run a command] ***********************************************************
changed: [controller1]
changed: [controller2]
changed: [controller3]

RUNNING HANDLER [run another command] ******************************************
changed: [controller1]

PLAY RECAP *********************************************************************
controller1                : ok=2    changed=2    unreachable=0    failed=0
controller2                : ok=2    changed=2    unreachable=0    failed=0
controller3                : ok=2    changed=2    unreachable=0    failed=0

Actual Results:

PLAY ***************************************************************************

TASK [run a command] ***********************************************************
changed: [controller1]
changed: [controller2]
changed: [controller3]

RUNNING HANDLER [run another command] ******************************************
changed: [controller3]
changed: [controller2]
changed: [controller1]

PLAY RECAP *********************************************************************
controller1                : ok=2    changed=2    unreachable=0    failed=0
controller2                : ok=2    changed=2    unreachable=0    failed=0
controller3                : ok=2    changed=2    unreachable=0    failed=0
@jimi-c jimi-c added this to the v2 milestone Oct 30, 2015
@jimi-c jimi-c closed this as completed in 56e5e72 Oct 30, 2015
@jimi-c
Copy link
Member

jimi-c commented Oct 30, 2015

Closing This Ticket

Hi!

We believe the above commit should resolve this problem for you. This will also be included in the next major release.

If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:

Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved.

Thank you!

@ianunruh
Copy link
Author

Thanks for the quick fix 👍

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants