I think you want special handlers, that started directly after task, not at the the end of all tasks. But I don't know about this handlers in Ansible. You can use "register: var1" and "when: var1.changed" in next task.
On Wednesday, March 9, 2016 at 2:09:52 PM UTC+5, Branko Majic wrote: > > Hello all, > > I have been running on occasion into situations where an incomplete run > could leave a system in inconsistent state. This has mostly happened in > cases where handlers are in use. > > As an example, let's say you have a task populating /etc/aliases for > Postfix. In order for Postfix to be able to use the data, /etc/aliases > has to be compiled using the newaliases command. This is a natural fit > for a single Ansible task + handler (this is a very simple case, I've > had some more complex cases too). > > The problem stems from the fact that Ansible playbook run could fail > before the handler fires off - leaving the /etc/aliases file updated, > but not the /etc/aliases.db (created via newaliases command). > > I am aware of the "force_handlers = True" option, however that won't > help in cases where failure is, say, due to SSH connection dropping > etc. > > From what I can tell, this scenario possibly happens exclusively when > using handlers, since those are rather stateless (I'm sure you could > also trigger such behaviour with poorly designed command/shell > combination of tasks). > > How do folks usually handle such situations? > > Best regards > > -- > Branko Majic > Jabber: [email protected] <javascript:> > Please use only Free formats when sending attachments to me. > > Бранко Мајић > Џабер: [email protected] <javascript:> > Молим вас да додатке шаљете искључиво у слободним форматима. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1bd05482-4b3b-4478-beb7-16ba1b6d80d6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
