Playbook Playback in Ansible

From bib. source

wait_for can be used to pause your playbook execution to wait for many different things:

  • Using host and port, wait a maximum of timeout seconds for the port to be available (or not).
  • Using path (and search_regex if desired), wait a maximum of timeout seconds for the file to be present (or absent).
  • Using host and port and drained for the state parameter, 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.