ansible / ansible.builtin / v2.9.27 / module / win_wait_for_process Waits for a process to exist or not exist before continuing. | "added in version" 2.7 of ansible.builtin" Authors: Charles Crossan (@crossan007) preview | supported by communityansible.builtin.win_wait_for_process (v2.9.27) — module
pip
Install with pip install ansible==2.9.27
Waiting for a process to start or stop.
This is useful when Windows services behave poorly and do not enumerate external dependencies in their manifest.
- name: Wait 300 seconds for all Oracle VirtualBox processes to stop. (VBoxHeadless, VirtualBox, VBoxSVC) 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 win_wait_for_process: process_name_exact: cmd state: present timeout: 500 sleep: 5 process_min_count: 3
pid: description: - The PID of the process. type: int owner: description: - The owner of the process. - Requires PowerShell version 4.0 or newer. type: str sleep: default: 1 description: - 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. type: int state: choices: - absent - present default: present description: - When checking for a running process C(present) will block execution until the process exists, or until the timeout has been reached. C(absent) will block execution until the process no longer exists, or until the timeout has been reached. - When waiting for C(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 C(absent), new processes matching the supplied pattern are started, these new processes will not be included in the action. type: str timeout: default: 300 description: - The maximum number of seconds to wait for a for a process to start or stop before erroring out. type: int pre_wait_delay: default: 0 description: - Seconds to wait before checking processes. type: int post_wait_delay: default: 0 description: - Seconds to wait after checking for processes. type: int process_min_count: default: 1 description: - Minimum number of process matching the supplied pattern to satisfy C(present) condition. - Only applies to C(present). type: int process_name_exact: description: - The name of the process(es) for which to wait. The name of the process(es) should not include the file extension suffix. type: list process_name_pattern: description: - RegEx pattern matching desired process(es). type: str
elapsed: description: The elapsed seconds between the start of poll and the end of the module. returned: always sample: 3.14159265 type: float matched_processes: contains: name: description: The name of the matched process. returned: always sample: svchost type: str owner: description: The owner of the matched process. returned: when supported by PowerShell sample: NT AUTHORITY\SYSTEM type: str pid: description: The PID of the matched process. returned: always sample: 7908 type: int description: List of matched processes (either stopped or started). returned: always type: complex