rootatdarkstar
rootatdarkstar

Reputation: 1526

Ansible-playbook: directly run handler

Is there a way to directly run handler by ansible-playbook?

For example, i have handler restart service in my role and sometimes i want just trigger it directly without deploying whole app.

Upvotes: 10

Views: 14720

Answers (1)

Xiong Chiamiov
Xiong Chiamiov

Reputation: 13694

There are a number of options answered in a similar post on ServerFault. In summary:

Options for triggering a particular handler:

  • Use a no-op command to trigger it
  • Use a debug with changed_when: true to trigger it

Options for triggering all handlers:

  • Run with --force-handlers
  • Use a meta: flush_handlers task

Options for re-architecting:

  • Use a task instead

Upvotes: 14

Related Questions