force handlers to run

34 views
Skip to first unread message

Jacob Weber

unread,
Feb 23, 2015, 3:16:29 PM2/23/15
to ansible...@googlegroups.com
Say I have a playbook like this:

- name: install apache config
  copy: src=httpd.conf dest=/etc/httpd.conf
  notify: restart apache
- name: do something that fails
  command: false

I ran it without --force-handlers. The first command ran successfully, and reported a change. The second command failed, and as a result, the "restart apache" handler doesn't get called.

If I run it again, even with --force-handlers, the first command won't report a change, so the handler still won't get called. This leaves the node in an incomplete state.

Is there a way to handle this kind of situation easily? Obviously in this case I can manually restart Apache, but in more complex cases, I'd like to be able to force the handler to run.

Or is the solution to always run with --force-handlers, so it never gets in this state to begin with?

Thanks,
Jacob

Brian Coca

unread,
Feb 23, 2015, 6:28:31 PM2/23/15
to ansible...@googlegroups.com
Yes, currently the only way to avoid that is always run with
--force-handlers. I do have on the wishlist to add this to ansible.cfg
so you can set it globally and not specify it.


--
Brian Coca
Reply all
Reply to author
Forward
0 new messages