Conditional restart

128 views
Skip to first unread message

Toby Hobson

unread,
Apr 30, 2015, 8:11:34 AM4/30/15
to ansible...@googlegroups.com
I have a fairly typical set of tasks, which basically ensure that given packages are installed and up to date. I can run the playbook several times and ansible is smart enough to check whether the packages are already installed before trying to install them again. Is there a way to tie in a conditional restart similar to the way salt has watches? Basically I want to restart the server only when a change has been made.

Matt Martz

unread,
Apr 30, 2015, 8:27:06 AM4/30/15
to ansible...@googlegroups.com
I believe what you are looking for are handlers.  See http://docs.ansible.com/playbooks_intro.html#handlers-running-operations-on-change

It allows you to define a task (handler) which can be notified to run by another task that returns a change.

On Thu, Apr 30, 2015 at 7:11 AM, Toby Hobson <toby....@gmail.com> wrote:
I have a fairly typical set of tasks, which basically ensure that given packages are installed and up to date. I can run the playbook several times and ansible is smart enough to check whether the packages are already installed before trying to install them again. Is there a way to tie in a conditional restart similar to the way salt has watches? Basically I want to restart the server only when a change has been made.

--
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/d6aaf35a-87eb-448e-9c33-9e67dd9c435c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages