run handlers at

Hello,

In the following paragraph http://docs.ansible.com/playbooks_best_practices.html#task-and-handler-organization-for-a-role it says:

“…handlers are only fired when certain tasks report changes, and are run at the end of each play”

Is it possible to run handlers directly instead of the end of each play? If not, is it possible to run a task after a handler has been run?

Thank you for your help?

Hi,

You can use

  • meta: flush_handlers

within your playbook, all pending handlers will be executed.
You can then go on with you playbook

The doc also state that:
"Roles are described later on. It’s worthwhile to point out that handlers are automatically processed between ‘pre_tasks’, ‘roles’, ‘tasks’, and ‘post_tasks’ "
http://docs.ansible.com/playbooks_intro.html#handlers-running-operations-on-change
So, if you need to run some tasks after you handlers have been fired, you can use a “post_tasks” section at the end of you playbook.

Cheers,

Fred