ansible.windows.win_wait_for – Waits for a condition before continuing¶
Note
This plugin is part of the ansible.windows collection (version 1.4.0).
To install it use: ansible-galaxy collection install ansible.windows
.
To use it in a playbook, specify: ansible.windows.win_wait_for
.
Synopsis¶
You can wait for a set amount of time
timeout
, this is the default if nothing is specified.Waiting for a port to become available is useful for when services are not immediately available after their init scripts return which is true of certain Java application servers.
You can wait for a file to exist or not exist on the filesystem.
This module can also be used to wait for a regex match string to be present in a file.
You can wait for active connections to be closed before continuing on a local port.
Parameters¶
See Also¶
See also
- ansible.builtin.wait_for
The official documentation on the ansible.builtin.wait_for module.
- community.windows.win_wait_for_process
The official documentation on the community.windows.win_wait_for_process module.
Examples¶
- name: Wait 300 seconds for port 8000 to become open on the host, don't start checking for 10 seconds
ansible.windows.win_wait_for:
port: 8000
delay: 10
- name: Wait 150 seconds for port 8000 of any IP to close active connections
ansible.windows.win_wait_for:
host: 0.0.0.0
port: 8000
state: drained
timeout: 150
- name: Wait for port 8000 of any IP to close active connection, ignoring certain hosts
ansible.windows.win_wait_for:
host: 0.0.0.0
port: 8000
state: drained
exclude_hosts: ['10.2.1.2', '10.2.1.3']
- name: Wait for file C:\temp\log.txt to exist before continuing
ansible.windows.win_wait_for:
path: C:\temp\log.txt
- name: Wait until process complete is in the file before continuing
ansible.windows.win_wait_for:
path: C:\temp\log.txt
regex: process complete
- name: Wait until file is removed
ansible.windows.win_wait_for:
path: C:\temp\log.txt
state: absent
- name: Wait until port 1234 is offline but try every 10 seconds
ansible.windows.win_wait_for:
port: 1234
state: absent
sleep: 10
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Jordan Borean (@jborean93)