Ansible - until parameter (while loop)

In this example, the ps command will be executed once every 2 seconds until string "Hello World" is found in the stdout, a maximum of 10 times.

- hosts: localhost
  - shell: "ps -ef | grep foo | wc -l"
    register: result
    until: "result.stdout.find('Hello World') != -1"
    retries: 10
    delay: 2


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter d03c4 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |