Serial: 1 only for one play

17 views
Skip to first unread message

Gin

unread,
Jul 6, 2017, 8:04:59 AM7/6/17
to Ansible Project
Hi,

When I set serial:1 for one of the plays in a playbook, the whole playbook is then processed one host at a time.
Is this the intended behaviour?

Is it possible to apply serial:1 only to one play? 
E.g. if I have a playbook comprising three plays: p1, p2 (with serial:1) and p3 then p1 and p3 would be executed in parallel across relevant hosts and the p2 would run sequentially for each host.

Ansible 2.3.1.0

Thanks,
Gintas

Kai Stian Olstad

unread,
Jul 6, 2017, 9:34:49 AM7/6/17
to ansible...@googlegroups.com
> When I set serial:1 for one of the plays in a playbook, the whole
> playbook
> is then processed one host at a time.
> Is this the intended behaviour?

I can't confirm this on 2.3.1


> Is it possible to apply serial:1 only to one play?
> E.g. if I have a playbook comprising three plays: p1, p2 (with
> serial:1)
> and p3 then p1 and p3 would be executed in parallel across relevant
> hosts
> and the p2 would run sequentially for each host.

It does work like that.

playbook.yml
---
- name: p1
hosts: all
tasks:
- name: Task p1
raw: hostname

- name: p2
hosts: all
serial: 1
tasks:
- name: Task p2
raw: hostname

- name: p3
hosts: all
tasks:
- name: Task p3
raw: hostname

Result:

PLAY [p1] ******************************

TASK [Task p1] *************************
changed: [a1]
changed: [a2]

PLAY [p2] ******************************

TASK [Task p2] *************************
changed: [a1]

PLAY [p2] ******************************

TASK [Task p2] *************************
changed: [a2]

PLAY [p3] ******************************

TASK [Task p3] *************************
changed: [a2]
changed: [a1]

--
Kai Stian Olstad

Gintautas Sulskus

unread,
Jul 6, 2017, 9:45:42 AM7/6/17
to ansible...@googlegroups.com
Thanks for the response Kai.

Now it is working for me as well. I can no longer reproduce the problem.

Apologies for the false alarm.

Best,
Gintas
> --
> 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/uTyzo068i8c/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.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/971c4136298419c18d24a85fedea1058%40olstad.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages