Using variables as dictionary keys

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

Similar request here:

Ahh, I’ll have to think of another way to do it then. Thanks Dan!

Paddy