How do you re-run a playbook only on the hosts that failed?
IntermediateProductionRapid-Fire Commands
Answer
Enable retry files, then limit to the generated file:
# ansible.cfg
[defaults]
retry_files_enabled = True
retry_files_save_path = ~/.ansible/retry
ansible-playbook site.yml --limit @~/.ansible/retry/site.retry
Retry files are off by default. In AWX, use "Relaunch on failed hosts" from the job page instead.
More on Rapid-Fire Commands
How do you see which hosts a playbook would run against, without running it?BeginnerHow do you list the tasks and tags a playbook contains?BeginnerHow do you inspect the inventory structure and a host's variables?BeginnerHow do you restart a service on a group with an ad-hoc command?BeginnerHow do you resume a playbook from a specific task or step through it?BeginnerHow do you check the value a variable resolves to on a specific host?Intermediate