Note
This plugin is part of the community.windows collection (version 1.7.0).
You might already have this collection installed if you are using the ansible
package. It is not included in ansible-core
. To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.windows
.
To use it in a playbook, specify: community.windows.win_wait_for_process
.
Parameter | Choices/Defaults | Comments |
---|---|---|
owner string | The owner of the process. Requires PowerShell version 4.0 or newer. | |
pid integer | The PID of the process. | |
post_wait_delay integer | Default: 0 | Seconds to wait after checking for processes. |
pre_wait_delay integer | Default: 0 | Seconds to wait before checking processes. |
process_min_count integer | Default: 1 | Minimum number of process matching the supplied pattern to satisfy present condition.Only applies to present . |
process_name_exact list / elements=string | The name of the process(es) for which to wait. The name of the process(es) should not include the file extension suffix. | |
process_name_pattern string | RegEx pattern matching desired process(es). | |
sleep integer | Default: 1 | Number of seconds to sleep between checks. Only applies when waiting for a process to start. Waiting for a process to start does not have a native non-polling mechanism. Waiting for a stop uses native PowerShell and does not require polling. |
state string |
| When checking for a running process present will block execution until the process exists, or until the timeout has been reached. absent will block execution until the process no longer exists, or until the timeout has been reached.When waiting for present , the module will return changed only if the process was not present on the initial check but became present on subsequent checks.If, while waiting for absent , new processes matching the supplied pattern are started, these new processes will not be included in the action. |
timeout integer | Default: 300 | The maximum number of seconds to wait for a for a process to start or stop before erroring out. |
See also
The official documentation on the ansible.builtin.wait_for module.
The official documentation on the ansible.windows.win_wait_for module.
- name: Wait 300 seconds for all Oracle VirtualBox processes to stop. (VBoxHeadless, VirtualBox, VBoxSVC) community.windows.win_wait_for_process: process_name_pattern: 'v(irtual)?box(headless|svc)?' state: absent timeout: 500 - name: Wait 300 seconds for 3 instances of cmd to start, waiting 5 seconds between each check community.windows.win_wait_for_process: process_name_exact: cmd state: present timeout: 500 sleep: 5 process_min_count: 3
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. Sample: 3.14159265 | |
matched_processes complex | always | List of matched processes (either stopped or started). | |
name string | always | The name of the matched process. Sample: svchost | |
owner string | when supported by PowerShell | The owner of the matched process. Sample: NT AUTHORITY\SYSTEM | |
pid integer | always | The PID of the matched process. Sample: 7908 |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/windows/win_wait_for_process_module.html