Changing serial mode per task in playbook?

175 views
Skip to first unread message

Martin Božič

unread,
Feb 3, 2022, 4:08:29 AM2/3/22
to Ansible Project
Hi everyone,

I'd like do a following scenario:

- commit a change in Puppet repo which has config for servers
   - before this commit gets pulled in by Puppet daemons on servers I want to force
- run the Ansible playbook
   - task1: stop Puppet daemons on all servers at once (parallel task)
   - task2: serially run an an Ansible task community.general.puppet on each server

I already do rolling updates with "serial: 1" in all the updates. Considering on the format of the playbooks and documentation it seems to me I'd have to make two separate playbooks, one with parallel execution and one with serial? Or am I wrong and it can be done within one playbook? Maybe it's possible to work around the problem with include_tasks or import_tasks?

Martin

Todd Lewis

unread,
Feb 3, 2022, 7:37:05 AM2/3/22
to Ansible Project
You can have multiple plays within one playbook.

Brian Coca

unread,
Feb 3, 2022, 11:18:45 AM2/3/22
to Ansible Project
also 'throttle', it is not the same as 'serial' but it is what many
people actually want (serial keyword has many implications aside from
reducing parallelism).

--
----------
Brian Coca

Martin Božič

unread,
Feb 4, 2022, 8:30:43 AM2/4/22
to ansible...@googlegroups.com
Thanks for both of the suggestions! I tried both and figured out that multiple plays in one playbook with the second play using "serial: 1" works for me alright.

Thanks,
Martin

V V čet., 3. feb. 2022 ob 17:18 je oseba Brian Coca <bc...@redhat.com> napisala:
--
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/FqTPdH7bdjE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CACVha7dPonZrKqB3ahc_4_7xkBRAhbG%2B0ZdBhO28%3DxbzJaWvyw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages