# ERROR! 'retries' is not a valid attribute for a TaskInclude

**URL:** <https://forum.ansible.com/t/error-retries-is-not-a-valid-attribute-for-a-taskinclude/32993>\
**Category:** Ansible Project\
**Created:** [May 21, 2020, 2:48am UTC](https://forum.ansible.com/t/error-retries-is-not-a-valid-attribute-for-a-taskinclude/32993 "2020-05-21T02:48:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shifa\_Shaikh](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Shifa\_Shaikh](https://forum.ansible.com/u/Shifa_Shaikh)\
**Post date:** [May 21, 2020, 2:48am UTC](https://forum.ansible.com/t/error-retries-is-not-a-valid-attribute-for-a-taskinclude/32993/1 "2020-05-21T02:48:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [May 21, 2020, 5:18am UTC](https://forum.ansible.com/t/error-retries-is-not-a-valid-attribute-for-a-taskinclude/32993/2 "2020-05-21T05:18:59Z")

</div>

> 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:Startservice  
> include\_tasks:"{{ playbook-dir }}/inner.yml"  
> retries:5  
> delay:4  
> until:stopprocesscount.stdout isversion('2','\<')  
> \>
> 
> cat inner.yml
> 
> \>  
> -name:Startservice  
> shell:~/stop-all  
> register:stopprocess
> 
> -name:Startservice  
> shell:ps -fu user1 |wc -l  
> register:stopprocesscount  
> \>
> 
> However, I get the below error running the playbook.
> 
> \>  
> ERROR!'retries'isnota valid attribute fora TaskInclude
> 
> Theerror appears to be in'/app/playbook/stop.yml':line 19,column 9,but may  
> be elsewhere inthe file depending on the exact syntax problem.
> 
> Theoffending line appears to be:
> 
> -name:Startservice  
> ^here  
> \>
> 
> Can you please suggest?

The question is why you don't use one of the various mechanism on a Linux system to ensure  
that a process is started or stopped.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Shifa\_Shaikh](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@Shifa\_Shaikh](https://forum.ansible.com/u/Shifa_Shaikh)\
**Post date:** [May 21, 2020, 12:45pm UTC](https://forum.ansible.com/t/error-retries-is-not-a-valid-attribute-for-a-taskinclude/32993/3 "2020-05-21T12:45:59Z")

</div>

@Stefan Our service involves a set of processes thus, the start script invokes those several processes and hence the need to count the number of processes using `wc -l` to determine if the service (not the process) is running or not.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [May 21, 2020, 12:51pm UTC](https://forum.ansible.com/t/error-retries-is-not-a-valid-attribute-for-a-taskinclude/32993/4 "2020-05-21T12:51:31Z")

</div>

This sounds all very much like pushing a round peg into a square hole.

I would focus on fine tuning some systemd unit files and their dependencies, instead of the carpet stopping/starting approach.

---

<div class="post-metadata">

**Author:** ![Suneel\_Gali](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Suneel\_Gali](https://forum.ansible.com/u/Suneel_Gali)\
**Post date:** [May 21, 2020, 4:43pm UTC](https://forum.ansible.com/t/error-retries-is-not-a-valid-attribute-for-a-taskinclude/32993/5 "2020-05-21T16:43:31Z")

</div>

> > > > " ERROR! ‘retries’ is not a valid attribute for a TaskInclude"  
> > > > Can we use “until” against include\_tasks?

Its like we are inserting the same tasks multiple times in the playbook …

Can you use until condition with the actual task itself and check?
