Ok that doesn't work in my example as the variables aren't in the inventory
TASK: [debug ]
****************************************************************
fatal: [localhost] => One or more undefined variables: 'dict' object has no
attribute 'admin_port'
Though If use include_vars which I would be doing its does work
- hosts: localhost
connection: local
vars:
test_app: admin
tasks:
- include_vars: concat_vars.yml
- debug:
msg: "admin port from inventory = {{
hostvars[inventory_hostname][test_app+'_port'] }}"
TASK: [debug ]
****************************************************************
ok: [localhost] => {
"msg": "admin port from inventory = *1234*"
}
Many thanks for your help. This forum is fantastic.
James
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/87095e5d-ff95-43f2-9859-75ae9133ffe6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.