trigger or force a handler

46 views
Skip to first unread message

Xu Chen

unread,
Mar 15, 2014, 10:36:42 PM3/15/14
to ansible...@googlegroups.com
I wonder if there is an elegant way to have a few tasks in a handler file, and execute them either triggered by other tasks or forced based on an input parameter.

Here is the scenario I have in mind..
1) use ansible to sync a git repo, if that repo is updated, trigger a build handler
2) execute something else, which causes an error

Since the handlers are executed in the end, if step 2) fails after step 1) is executed (which updates the repo), the build handler is never executed. The problem is that even if I fixed step 2), another Ansible run will not trigger the build - since the repo is considered unchanged for the second Ansible run.
 
I can probably flush the handlers right after step 1), but I'd prefer not do this. I wonder if I can pass in a parameter to ansible-play in the second run, to force the build handler. Or maybe you guys have better ideas? :-) Thanks..

Michael DeHaan

unread,
Mar 16, 2014, 12:27:16 PM3/16/14
to ansible...@googlegroups.com
This is a fairly common request.

The suggestion has been to implement something like a "--force-handlers" switch to Ansible playbook that runs all of them.

I think having to name the handlers might be too unfriendly.

--Michael


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6c4539f4-838d-4b2a-aef7-8dd6469f84f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages