New in version 2.4.
timeout
, this is the default if nothing is specified.Parameter | Choices/Defaults | Comments |
---|---|---|
connect_timeout int | Default: 5 | The maximum number of seconds to wait for a connection to happen before closing and retrying. |
delay int | The number of seconds to wait before starting to poll. | |
exclude_hosts list | The list of hosts or IPs to ignore when looking for active TCP connections when state=drained . | |
host | Default: 127.0.0.1 | A resolvable hostname or IP address to wait for. If state=drained then it will only check for connections on the IP specified, you can use '0.0.0.0' to use all host IPs. |
path path | The path to a file on the filesystem to check. If state is present or started then it will wait until the file exists.If state is absent then it will wait until the file does not exist. | |
port int | The port number to poll on host . | |
search_regex | Can be used to match a string in a file. If state is present or started then it will wait until the regex matches.If state is absent then it will wait until the regex does not match.Defaults to a multiline regex. | |
sleep int | Default: 1 | Number of seconds to sleep between checks. |
state |
| When checking a port, started will ensure the port is open, stopped will check that is it closed and drained will check for active connections.When checking for a file or a search string present or started will ensure that the file or string is present, absent will check that the file or search string is absent or removed. |
timeout int | Default: 300 | The maximum number of seconds to wait for. |
- name: wait 300 seconds for port 8000 to become open on the host, don't start checking for 10 seconds win_wait_for: port: 8000 delay: 10 - name: wait 150 seconds for port 8000 of any IP to close active connections 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 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 win_wait_for: path: C:\temp\log.txt - name: wait until process complete is in the file before continuing win_wait_for: path: C:\temp\log.txt search_regex: process complete - name: wait until file if removed win_wait_for: path: C:\temp\log.txt state: absent - name: wait until port 1234 is offline but try every 10 seconds win_wait_for: port: 1234 state: absent sleep: 10
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
elapsed float | always | The elapsed seconds between the start of poll and the end of the module. This includes the delay if the option is set. Sample: 2.1406487 |
wait_attempts int | always | The number of attempts to poll the file or port before module finishes. Sample: 1 |
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/win_wait_for_module.html