Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
What is best practice to determine if object has property (ideally at any depth)?
17 views
Skip to first unread message
ja...@blendlabs.com
unread,
Jan 10, 2017, 7:16:13 PM
1/10/17
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
What is the best way to test this condition?
when: "{{object is defined and object.property is defined and object.property.property is defined and object.property.property == 'mystring'}}"
A custom lookup?
Kai Stian Olstad
unread,
Jan 11, 2017, 3:50:21 AM
1/11/17
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...@googlegroups.com
What's best is always relative, but you could use this
when: ((object | default()).property | default()).property | default()
== 'mystring'
And remember, don't use curly brackets in when.
--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages