Groups
Groups
Sign in
Groups
Groups
Ansible Project
Conversations
About
Send feedback
Help
Why parameterized attribute lookup on ansible variables fail?
16 views
Skip to first unread message
moe_22
unread,
Jul 10, 2017, 11:46:52 AM
7/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
This is best explained by this example:
---
- name: getattr
hosts: 127.0.0.1
connection: local
vars:
- foo:
bar: "bar"
baz: "baz"
- bee: "bar"
tasks:
- name: get foo.bar
debug:
msg: "{{ foo|attr(bee) }}"
...
This fails, whay?
Brian Coca
unread,
Jul 11, 2017, 1:34:25 PM
7/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 Project
its a dictionary, not an object, the following will get you the result you want:
msg: "{{foo[bee]}}"
----------
Brian Coca
moe_22
unread,
Jul 11, 2017, 7:35:29 PM
7/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 Project
Thanx.
Reply all
Reply to author
Forward
0 new messages