Ansible-playbook: directly run handler

ansible, configuration

Solution

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

Problem

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.

Original source