Handlers are typically more useful in that multiple tasks can trigger them via the notify: action, so they will only run if the task has changed. Otherwise, the task will always run and you may bounce services unnecessarily.
On Thu, May 1, 2014 at 4:00 AM, Andrew Pashkin <[email protected]>wrote: > Hi! > I just started to learn Ansible. > In the docs <http://docs.ansible.com/playbooks_intro.html>, there is such > words: > >> These ‘notify’ actions are triggered at the end of each block of tasks in >> a playbook, and will only be triggered once even if notified by multiple >> different tasks. >> >> For instance, multiple resources may indicate that apache needs to be >> restarted because they have changed a config file, but apache will only be >> bounced once to avoid unnecessary restarts. >> > Is it correct, that if I want that apache to be restarted after certain > task, not after all tasks, I need to insert task with restart action, after > that task? > > Docs also states: > >> Handlers are lists of tasks, not really any different from regular >> tasks... >> > > Is it all means, that there is no difference between notify and if I just > put special tasks )with restarts etc) in the end of a playbook? > > -- > 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/954c3f78-4ee0-4cda-935f-0dd24c500ced%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/954c3f78-4ee0-4cda-935f-0dd24c500ced%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAMFyvFgpge7kJWwZbZVPvFN8OepozHYfya5S4Dk3bSMHY4pZEg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
