cross-playbook serial?

48 views
Skip to first unread message

Hagai Kariti

unread,
Dec 16, 2014, 10:41:04 AM12/16/14
to ansible...@googlegroups.com
Hi
I'm running a deployment that consists of different plays, some of which are already written that I would like to reuse. There's about one one play for each stage:

1) Remove server from cluster
2) Shut down the server
3) Provision a new server to replace it

When running, I need each set of plays to run on one server at a time, so setting 'serial' on the play level isn't enough. I know I can run another ansible-playbook instance with the command module, but then I wouldn't see the progress for each play. I guess I can copy-paste my existing playbooks and play with delegate_to to achieve what I want, but that feels wrong. What I'm doing currently is splitting my playbook run to several pieces and gluing them with bash, looping when necessary on a single playbook.

It feels like Ansible doesn't support this use case well currently. Is there a better way to solve that than using bash? Are there features in the pipeline to help with this case?

Thanks a lot!


kesten broughton

unread,
Dec 16, 2014, 12:57:18 PM12/16/14
to ansible...@googlegroups.com
+1
I have this problem a lot when I use delegate_to with multiple targets making a request of a single delegate.  Lock conflicts cause intermittent failure.

Michael DeHaan

unread,
Dec 16, 2014, 1:36:37 PM12/16/14
to ansible...@googlegroups.com
Sounds like you are looking for a flag to override --serial to me, which may be reasonable.

In the meantime, can you just set serial: 1 on each play?

--
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/dc2cc05f-f534-41b6-836e-a6b73cfaa298%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hagai Kariti

unread,
Dec 16, 2014, 1:48:08 PM12/16/14
to ansible...@googlegroups.com

That won't help me. If i have one play to remove a node from a cluster, one to shut it down and one to provision a new one, i need the tasks in all of them to run for each host. Removing all nodes, then shutting them all down, etc isn't good.

Ideally I'd have one task for each. But when that task is a play by itself, that's where my problem is.

You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/TEI_QTbjV6Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.

Brian Coca

unread,
Dec 16, 2014, 2:33:54 PM12/16/14
to ansible...@googlegroups.com
so I think you need 4 plays, make the tasks into their own files, use
- include in all plays, you have the same tasks but use the different
plays for each of the different needs.

plays 1,2,3 as you have now, play 4, with serial: 1, uses tasks from
play 1, 2 and 3 in order.
> https://groups.google.com/d/msgid/ansible-project/CAO0%3DbmHtH1ZywazJhCGLpoRPacQ1U-13Yjqcy3EUDpgNFJo1Eg%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Brian Coca

Hagai Kariti

unread,
Dec 17, 2014, 3:32:24 AM12/17/14
to ansible...@googlegroups.com
Thanks Brian, that looks like it could work. I'm not sure I like doing a small refactor for this though. Plus I still have to copy the 'role:' sections. Eh.. I'll think of something. Thanks!

Reply all
Reply to author
Forward
0 new messages