Using variables as dictionary keys

52 views
Skip to first unread message

Patrick McMahon

unread,
Sep 15, 2015, 12:57:57 PM9/15/15
to Ansible Project
Hi,

Is something like this possible when defining a dictionary in defaults/main.yml:

agent_instances:
 
"{{ [ansible_fqdn] }}":
    port
: 5912
 
"{{ [ansible_fqdn]-2 }}":
    port
: 5913


I want to then call agent_instances.keys() | join (",") in a jinja2 template.

Thanks in Advance!

Paddy

Dan Stillman

unread,
Sep 15, 2015, 3:24:37 PM9/15/15
to ansible...@googlegroups.com

Patrick McMahon

unread,
Sep 15, 2015, 4:08:35 PM9/15/15
to Ansible Project
Ahh, I'll have to think of another way to do it then. Thanks Dan!

Paddy
Reply all
Reply to author
Forward
0 new messages