Changing serial mode per task in playbook?

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

You can have multiple plays within one playbook.

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).

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 <bcoca@redhat.com> napisala: