Playbook Playback in Ansible
From bib. source
wait_forcan be used to pause your playbook execution to wait for many different things:
- Using
hostandport, wait a maximum oftimeoutseconds for the port to be available (or not).- Using
path(andsearch_regexif desired), wait a maximum oftimeoutseconds for the file to be present (or absent).- Using
hostandportanddrainedfor thestateparameter, check if a given port has drained all its active connections.- Using
delay, you can simply pause playbook execution for a given amount of time (in seconds).
That is, the field or key wait_for allows pausing Ansible playbook execution until a given event has transpired, and the given event can be specified by using a sub-field of wait_for (Geerling 2023, 115). This can allow one to prevent failure of tasks in a playbook that depend on precise timing (Ibid).
task fields keys options YAML Yet_Another_Markup_Language YAML_Aint_Markup_Language configuration_management
bibliography
- “Ansible Playbooks - Beyond the Basics.” In Ansible for DevOps: Server and Configuration Management for Humans, 2nd ed., 84–122. Leanpub, 2023.