Reputation: 173
is it possible to handle processes that are long running and may not keep an application running in the cli. for example zfs scrub /tank completes in a few seconds yet the process of the scrub continues in the background. there is a utility called zed that can run a script or other actions when the scrub completes to get the details of the scrub. is there a way that ansible can handle situations like this to receive results and act on them or is this something that a tool like jenkins would be needed
Upvotes: 1
Views: 541
Reputation: 9353
Use the wait_for module to make Ansible wait for the process to complete.
For example, you could configure the zed utility to create a file when the scrub process completes.
- name: Wait until the file /tmp/scrub-results is present before continuing
wait_for:
path: /tmp/scrub-results
The wait_for module can test many other conditions such as the presence of an open port or specific content to appear in a file. It can also watch a specific process ID until it terminates.
It is best to read the documentation to determine which is most suitable for your use case.
Upvotes: 1