On 5/21/20 4:48 AM, Shifa Shaikh wrote:
> 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
          Racke

> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/8a89923a-eebf-433a-92d7-4098c7af2b03%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/8a89923a-eebf-433a-92d7-4098c7af2b03%40googlegroups.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dd2ea375-11ce-672c-7f78-c1809117bdbe%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to