@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.
On Thursday, May 21, 2020 at 8:18:56 AM UTC+5:30, 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: 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?
>
--
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/4a53d56d-3e8a-4929-9cbd-b4b3d67b8237%40googlegroups.com.