How does the `reboot` module work and what options matter?
IntermediateProductionRolling Updates, Delegation and Safe Deployments
Answer
It issues a reboot command, waits for the host to go down, then waits until it is reachable again and a test command succeeds. This avoids hand-built shutdown plus wait_for_connection logic.
- ansible.builtin.reboot:
reboot_timeout: 1200
pre_reboot_delay: 5
post_reboot_delay: 30
test_command: systemctl is-system-running --wait
msg: "Reboot by Ansible patch run"
reboot_timeout should cover slow bare-metal firmware or large instances. The module needs become and, for Windows hosts, the ansible.windows.win_reboot equivalent. Add a post_reboot_delay if services start slowly after the connection comes back.
More on Rolling Updates, Delegation and Safe Deployments
How do you do a rolling update with Ansible?BeginnerWhat forms can `serial` take?IntermediateShow the standard pattern for a zero-downtime rolling deploy behind a load balancer.IntermediateWhy do you add a health check inside the deployment play?BeginnerHow do `any_errors_fatal` and `max_fail_percentage` help a rollout?BeginnerHow do you do a canary deployment?Intermediate