Ansible task that retries

- name: Run a local task 
  connection: local
      - name: loop the loop
            return_content: yes
        register: foo
        until: foo.content.find("monkeys") != -1
        delay: 1
        retries: 5

The task can be whatever you want: I used uri but it’s more usually shell or something like that. The main thing is that you need to use register so you’ll have something to check in the until: condition.


Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.