Hosts need rebooting after a kernel patch, one at a time, and the play must wait for them to return.
IntermediateScenarioRolling Updates, Delegation and Orchestration
Answer
Situation read → Safe reboot.
What I'd do →
- hosts: all
serial: 1
tasks:
- ansible.builtin.reboot:
reboot_timeout: 900
post_reboot_delay: 20
test_command: systemctl is-system-running --wait
Why → The reboot module handles the disconnect, polls until SSH returns and runs a test command.
Interview tip → Never use shell: reboot with async; the module exists for this.
More on Rolling Updates, Delegation and Orchestration
You must deploy a new app version to 40 web servers behind a load balancer with zero downtime.AdvancedWhat does `serial: [1, 5, "50%"]` do?BeginnerDuring a rolling update, 3 of 10 hosts in a batch fail. Does the play continue?IntermediateYou must restart database replicas one at a time but never the primary first.AdvancedYou need a task to run on the LB for every web host, without logging into each web host.IntermediateA shell command must run on localhost for each remote host, e.g. a CLI call to a cloud API.Beginner