My requirement is to run the script stop-all as many times (5 retries) until the output of ps -fu user1 |wc -l becomes less than 2.
I wrote the below ansible playbook for the same:
cat stop.yml
  - hosts: dest_nodes
    tasks:
      - name: Start service
        include_tasks: "{{ playbook-dir }}/inner.yml"
        retries: 5
        delay: 4
        until: stopprocesscount.stdout is version('2', '<')
cat inner.yml
      - name: Start service
          shell: ~/stop-all
          register: stopprocess
      - name: Start service
          shell: ps -fu user1 |wc -l
          register: stopprocesscount
However, I get the below error running the playbook.
ERROR! 'retries' is not a valid attribute for a TaskInclude
The error appears to be in '/app/playbook/stop.yml': line 19, column 9, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
      - name: Start service
        ^ here
Can you please suggest?
 
     
    