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 [email protected] wrote:

> 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
> United States Department of Commerce
>
> On Monday, August 15, 2022 at 3:44:26 PM UTC-4 Felix Fontein wrote:
>
>> 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
>> Ansible is pretty helpful here:
>>
>> > This one looks easy to fix. It seems that there is a value started
>> > with a quote, and the YAML parser is expecting to see the line ended
>> > with the same kind of quote. For instance:
>> > 
>> > when: "ok" in result.stdout
>> > 
>> > Could be written as:
>> > 
>> > when: '"ok" in result.stdout'
>> > 
>> > Or equivalently:
>> > 
>> > when: "'ok' in result.stdout"
>>
>> Cheers,
>> Felix
>>
>

-- 
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/88bf67d4-23fb-4b6f-8387-2cba80db70ean%40googlegroups.com.

Reply via email to