Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
evaluating a variable value as boolean
29 views
Skip to first unread message
Shashank Dutt Jha
unread,
Jul 11, 2019, 8:34:32 AM
7/11/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
I have defined variable
happened: true
When am trying to use this variable in task in conditional when clause it failed
when: {{happened}} | bool == true it gives error.
what is the correct syntax to use it?
Soniya panwar
unread,
Jul 12, 2019, 2:53:15 AM
7/12/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hello Shashank,
This statement is getting failed because you didn't use double quotes (" ") in your command.
The correct syntax to use this statement is:
when
:
"{{happened}} | bool == true"
Thanks
Soniya
Brian Coca
unread,
Jul 15, 2019, 11:17:25 AM
7/15/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
conditionals already assume {{ }} context, so unless you are
specifically aiming at double interpolation `when: happened|bool` is
all you need
--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages