Thank you, gentlemen, for your precious time and efforts, in clearing all 
the minor doubts.

Both the solutions worked for me, that Walter and Lewis presented. But 
Lewis optimized this more.

It was a productive discussion though.

Thanks & regards,

FARRUKH AHMED



On Tuesday, August 16, 2022 at 4:58:31 PM UTC+5 [email protected] wrote:

> Yes, that works also, and is simpler than my example. Nice!
>
> +++
> ---
> - name: testing when
>   hosts: localhost
>   become: no
>   gather_facts: no
>   vars:
>     my_lines:
>       - "idle-queue:idle-queue_00         RUNNING   pid 32292, uptime 
> 1:21:01"
>
>       - "idle-queue:idle-queue_01         RUNNING   pid 32293, uptime 
> 1:21:01"
>       - "idle-queue:idle-queue_02         RUNNING   pid 32291, uptime 
> 1:21:01"
>   tasks:
>
>     - debug: msg="running found"
>
> *      when: my_lines is search('RUNNING') *+++
>
> ... yields ...
>
>
> +++
> % ansible-playbook -i localhost, foo.yml
>
> PLAY [testing when] 
> ****************************************************************************************************
>
> TASK [debug] 
> ***********************************************************************************************************
> ok: [localhost] => {
>
> *    "msg": "running found" *}
>
> PLAY RECAP 
> *************************************************************************************************************
> localhost                  : ok=1    changed=0    unreachable=0  
>   failed=0    skipped=0    rescued=0    ignored=0   
> +++
>
> Walter 
> --
> Walter Rowe, Chief
> Infrastructure Services
> Office of Information Systems Management
> National Institute of Standards and Technology
> United States Department of Commerce
>

-- 
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/695c4a74-eb5b-42bc-8e22-e74dff316a48n%40googlegroups.com.

Reply via email to