FreeKB - ansible-playbook command - until loop
ansible-playbook command - until loop

Home > Search

This assumes you have installed Ansible Tower and are familiar with the ansible-playbook command.

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.

- 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 b07af in the box below so that we can be sure you are a human.