Running tasks in sequence on different hosts

292 views
Skip to first unread message

Henning Juva

unread,
Mar 27, 2014, 1:32:20 PM3/27/14
to ansible...@googlegroups.com
Hi,

First thanks for a wonderful tool. Best new technology I've used since git.

We currently manage about 20 machines using a role based setup described in best practices. So far everything has been easy and intuitive but now I've come across a corner case I'm struggling to fit into the model.

I want to setup a number of machines to be members of a cluster. It's currently a very manual process which requires a number of steps executed in order on different machines with some pauses added in. The old school shell script way would be something along these lines for machines A, B and C. There are maybe 20 steps in total.


A: Create cluster
B: Create cluster
C: Create cluster 
sleep 20
A: Add B
A: Add C
A: Create ensemble
sleep 20
B: join ensemble
C: join ensemble
etc...

Is there a way to achieve this nicely in ansible? I guess what I'm looking for is some way to execute tasks in sequence where each task could run on a different host than the previous. Like if you had a host attribute you could set directly on the task. At the moment I've looked at using the limit option and the hosts tag in the playbook but none seem a good match for this.

Any creative suggestions is welcome, otherwise I guess I'll just have to accept 1 remaining bash script.

Best regards,
Henning

Brian Coca

unread,
Mar 31, 2014, 7:49:13 PM3/31/14
to ansible...@googlegroups.com
sounds like you want multiple plays in the same file  and serial: 1
Reply all
Reply to author
Forward
0 new messages