By default, Ansible parallelises tasks on multiple hosts simultaneously and speeds up automation in large inventories. But sometimes, this is not ideal in a load-balanced environment, where upgrading the servers simultaneously may cause the loss of services. How do we use Ansible to run the updates at different times? I use the keyword “serial” before executing the roles universal package.
- hosts: standalone_nodes
become: yes
serial: 1
roles:
- linux_workstation
Alternatively, you can use percentages to indicate how many will upgrade at one time.
- hosts: standalone_nodes
become: yes
serial: 25%
roles:
- linux_workstation
References: