[ansible-project] Re: Error- When Condition

2022-08-16 Thread Todd Lewis
Rather than when: RUNNING in job_check.stdout_lines the canonical forms are either when: job_check.stdout_lines is search("RUNNING") or when: job_check.stdout is search("RUNNING") On Friday, August 12, 2022 at 2:01:26 AM UTC-4 farrukha...@gmail.com wrote: > Hello Team, > > Hope

Re: [ansible-project] Re: Error- When Condition

2022-08-15 Thread jbor...@gmail.com
That's not true, I do it all the time. The raw yaml value needs to be quoted but you still need to quote the inner string value to make sure it's interpreted as a string, e.g. when: '"RUNNING" in job_check.stdout_lines' On Tuesday, August 16, 2022 at 6:20:02 AM UTC+10 walte...@nist.gov wrote:

Re: [ansible-project] Re: Error- When Condition

2022-08-15 Thread 'Walter Rowe' via Ansible Project
I agree, and placing it in quotes doesn't fix it. I tested your suggestion and it also failed. It doesn't like starting a 'when' clause with a quote in any form. -- Walter Rowe, Chief Infrastructure Services Office of Information Systems Management National Institute of Standards and Technology U

Re: [ansible-project] Re: Error- When Condition

2022-08-15 Thread 'Felix Fontein' via Ansible Project
Hi, > You do not need double quote. A 'when' condition does not need to be > quoted. this has nothing to do with 'when' conditions, but with YAML parsing. A statement such as > when: "RUNNING" in job_check.stdout_lines will result in a YAML parsing error. Actually the error output from Ansi

Re: [ansible-project] Re: Error- When Condition

2022-08-15 Thread 'Walter Rowe' via Ansible Project
You do not need double quote. A 'when' condition does not need to be quoted. That said a 'when' condition also does not do an effective "grep" to see if one string is contained in a list of strings. It will do exact matches only. This will work. +++ --- - name: testing when hosts: localhost

Re: [ansible-project] Re: Error- When Condition

2022-08-15 Thread 'Felix Fontein' via Ansible Project
Hi, > Don't you need to put "RUNNING" in quotes? It is a string, no? > > when: "RUNNING" in job_check.stdout_lines actually you need double quotes, since YAML would complain about the quotes not being terminated correctly: > when: '"RUNNING" in job_check.stdout_lines' Alternatively you co

[ansible-project] Re: Error- When Condition

2022-08-15 Thread 'Walter Rowe' via Ansible Project
Don't you need to put "RUNNING" in quotes? It is a string, no? when: "RUNNING" in job_check.stdout_lines -- Walter Rowe, Chief Infrastructure Services Office of Information Systems Management National Institute of Standards and Technology United States Department of Commerce On Friday, August