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

Handlers don't execute tasks in included files #12238

Closed
bretmartin opened this issue Sep 3, 2015 · 3 comments
Closed

Handlers don't execute tasks in included files #12238

bretmartin opened this issue Sep 3, 2015 · 3 comments
Labels
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Milestone

Comments

@bretmartin
Copy link
Contributor

Issue Type:
  • Bug Report
Ansible Version:
ansible 2.0.0 (devel b2cb3153f1) last updated 2015/09/03 15:52:37 (GMT -400)
  lib/ansible/modules/core: (detached HEAD bbcfb1092a) last updated 2015/09/03 15:52:26 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD b8803306d1) last updated 2015/09/03 15:52:27 (GMT -400)
  config file = 
  configured module search path = None
Ansible Configuration:

no ansible.cfg, using defaults

Environment:

N/A but running on Mac OS X

Summary:

When I include a file in a handler, the tasks in the included file are not executed when the handler is called.

Steps To Reproduce:

roles/test/tasks/main.yml:


---

- name: test task
  command: /usr/bin/true
  changed_when: true
  notify: test handler

roles/test/handlers/main.yml:


---

- name: test handler
  include: roles/test/handlers/included.yml

roles/test/handlers/included.yml:


---

- debug: msg='hi there'
Expected Results:

The debug task in included.yml should be executed.

Actual Results:
ansible-playbook --vault-password-file=~/.ansible_vault_password \
        playbook-test.yml --limit=localhost -vvvv
No config file found; using defaults
1 plays in playbook-test.yml
Loaded callback default of type stdout, v2.0

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

TASK [setup] *******************************************************************
ESTABLISH LOCAL CONNECTION FOR USER: bam
localhost EXEC (umask 22 && mkdir -p "$HOME/.ansible/tmp/ansible-tmp-1441310284.44-82377294106907" && echo "$HOME/.ansible/tmp/ansible-tmp-1441310284.44-82377294106907")
localhost PUT /var/folders/n7/wrg1c7615892m2qgyv8r_yg00000gn/T/tmp8F90LL TO /Users/bam/.ansible/tmp/ansible-tmp-1441310284.44-82377294106907/setup
localhost EXEC LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /Users/bam/.ansible/tmp/ansible-tmp-1441310284.44-82377294106907/setup; rm -rf "/Users/bam/.ansible/tmp/ansible-tmp-1441310284.44-82377294106907/" > /dev/null 2>&1
ok: [localhost]

TASK [test : test task] ********************************************************
ESTABLISH LOCAL CONNECTION FOR USER: bam
localhost EXEC (umask 22 && mkdir -p "$HOME/.ansible/tmp/ansible-tmp-1441310285.06-125406317154986" && echo "$HOME/.ansible/tmp/ansible-tmp-1441310285.06-125406317154986")
localhost PUT /var/folders/n7/wrg1c7615892m2qgyv8r_yg00000gn/T/tmpDU_Jb8 TO /Users/bam/.ansible/tmp/ansible-tmp-1441310285.06-125406317154986/command
localhost EXEC LANG=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /Users/bam/.ansible/tmp/ansible-tmp-1441310285.06-125406317154986/command; rm -rf "/Users/bam/.ansible/tmp/ansible-tmp-1441310285.06-125406317154986/" > /dev/null 2>&1
changed: [localhost] => {"changed": true, "cmd": ["/usr/bin/true"], "delta": "0:00:00.004018", "end": "2015-09-03 15:58:05.303552", "rc": 0, "start": "2015-09-03 15:58:05.299534", "stderr": "", "stdout": "", "stdout_lines": [], "warnings": []}

RUNNING HANDLER [test : test handler] ******************************************
included: roles/test/handlers/included.yml for localhost

PLAY RECAP *********************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=0   
@jimi-c jimi-c added bug_report P2 Priority 2 - Issue Blocks Release labels Sep 4, 2015
@jimi-c jimi-c added this to the v2 milestone Sep 4, 2015
@jimi-c jimi-c closed this as completed in 7deb8bb Sep 12, 2015
@jimi-c
Copy link
Member

jimi-c commented Sep 12, 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!

@bretmartin
Copy link
Contributor Author

Fix confirmed over here with my test case and the playbook I originally discovered the bug in. Thanks @jimi-c!

@goldyfruit
Copy link

H guys,

I'm still having this issue, I'm using version 2.0.0.2.
Exactly the same issue than @bretmartin

Any idea guys ?

goldyfruit added a commit to uoi-io/ansible-corosync that referenced this issue Feb 9, 2016
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 6, 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. P2 Priority 2 - Issue Blocks Release
Projects
None yet
Development

No branches or pull requests

4 participants