"Is there a way to tell ansible to set a service restart task sometime in
the future? Say, right now for node1, 5 minutes later for node2, 10 minutes
later for node3, and so on."

There is a module for "at" which could be used to do this.

at runs some commands at scheduled times in the future, without setting up
a crontab.

You could also set a simple play like this, which would probably be cleaner:

- hosts: blarg
  serial: 1
  tasks:
    - pause: seconds={{ n }}
    - service: name=foo state=restarted

Which will walk across your infra 1 host at a time, with a lag of n seconds
between, and restart everything.  The serial: 1 could likely be increased
beyond 1 depending on the application context.






On Wed, Jul 23, 2014 at 7:16 PM, David Reagan <[email protected]> wrote:

> Specifically, an elasticsearch cluster, but doing this the right way would
> also apply to other kinds of clusters, like RabbitMQ or Redis.
>
> I'm using https://github.com/LaneCommunityCollege/aspects_elasticsearch
> to manage my elasticsearch cluster. Currently, if I modify the
> configuration settings, Ansible would issue a restart to all the nodes in
> the cluster.
>
> The obvious answer is to only run the playbook on one node at a time. But
> there are situations where that isn't convenient. If I run Ansible like a
> puppet agent then setting the configuration setting in the group_vars file
> will apply it on all the nodes, thus restarting them all. Or if I have a
> large number of nodes. Or simply need to apply the change, but don't have
> time to do it one or two nodes at a time.
>
> The other solutions I've thought of involve custom scripts that would not
> be part of the Ansible playbook. And likely be application specific.
>
> Is there a way to tell ansible to set a service restart task sometime in
> the future? Say, right now for node1, 5 minutes later for node2, 10 minutes
> later for node3, and so on.
>
> Maybe the at module? How would it know to set it 10 minutes in the future
> instead of 5 for the third node?
>
> So, yeah, is there a good Ansible specific method for this? Or do I need
> to look outside of Ansible?
>
> --
> 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/dcd691af-f8f3-47c8-b481-87a49c55ab89%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/dcd691af-f8f3-47c8-b481-87a49c55ab89%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/CA%2BnsWgwYB%3DW7EGYhYfSXw1On43n4%2B1GtHFO84yAZuucyaZPhGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to