Ansible: Handlers don't fire when using tags

Created on 18 Aug 2015  路  1Comment  路  Source: ansible/ansible

Issue Type:

Bug Report

Ansible Version:

ansible 1.9.2

Environment:

Mac OSX Yosemite

Summary:

When running a playbook with the --tags option, the tasks that are run that have notify: do not fire any handlers.

Steps To Reproduce:

Create a playbook that calls a role. In the role, specify a task that has notify: and place a handler task in handlers/main.yml. Call your ansible playbook with --tags config and observe that the notify handler won't be run.

Example task:

- stat:
  path: /tmp/testfile
  register: tmp_file
  notify:
    - Restart Service
  tags:
    - config

Note: the above task may not be the best representation of this issue, but rather just the basic outline of how we have tasks setup. It could just be as simple as copying a file and calling a notify afterwards

Expected Results:

The task with the tags should still honor the notify directive and fire any necessary handlers at the end of a playbook execution

Actual Results:

The playbook will complete without executing the handler at the end (or when specifying the meta: flush_handlers task)

P2 bug

Most helpful comment

Actually I just found out that I am incorrect. The handler is executing only when a task "changed" event occurs. This wasn't immediately apparent to me because it doesn't list them as "skipped", but this could be intended behavior.

My mistake, feel free to close this.

>All comments

Actually I just found out that I am incorrect. The handler is executing only when a task "changed" event occurs. This wasn't immediately apparent to me because it doesn't list them as "skipped", but this could be intended behavior.

My mistake, feel free to close this.

Was this page helpful?
0 / 5 - 0 ratings