wait_for

Collection: builtin

Full Name: parallax.builtin.wait_for

Aliases: ansible.builtin.wait_for, wait_for

Synopsis

Wait for a port, path or pattern to reach a given state

Parameters

NameTypeRequiredDefaultDescription
hoststring127.0.0.1A resolvable hostname or IP address to wait for
portintPort number to check
pathstringPath to a file on the filesystem that must exist before continuing
search_regexstringRegular expression to search for in the file or in the data read from the socket. Multiline by default
statestringstartedEither present, started, stopped, absent, or drained
timeoutint300Maximum number of seconds to wait, counted from before the delay
delayint0Number of seconds to wait before starting to poll
sleepint1Number of seconds to sleep between checks
connect_timeoutint5Maximum number of seconds to wait for a connection to happen before closing and retrying
exclude_hostslistList of hosts or IPs to ignore when looking for active TCP connections for state=drained
active_connection_stateslist[ESTABLISHED FIN_WAIT1 FIN_WAIT2 SYN_RECV SYN_SENT CLOSE_WAIT]The list of TCP connection states which are counted as active for state=drained
msgstringMessage to report instead of the default one when the condition is not met in time

Example

- name: Wait for the database port to accept connections
  wait_for:
    host: db1.internal
    port: 5432
    state: started
    timeout: 300