Variable name composition

Hello,

I'm trying to compose a variable name with another variable, to keep the variables for each host on a single file/definition.

It looks like the following:

vars.yml:

netconf:
    iface:
      eth1
    ip:
      host-1:
        172.16.1.100
      host-2:
        172.16.1.101
    mask:
      host-1:
        255.255.255.252
      host-2:
        255.255.255.252

Inventory:

[test]
host-1
host-2

playbook.yml:

- hosts: test
- tasks:
   - debug: msg="{{ netconf.ip.{{ ansible_hostname }} }}"

I know it can be done loading a different vars file for each host, but I would like to keep them together on a single file. Also this composition schema can be applied to other situations.

Anyone knows if It's possible to achieve that behavior?

BR,
Antonio

Here is how you can construct variable names programatically:

http://docs.ansible.com/faq.html#how-do-i-access-a-variable-name-programatically

You cannot nest templates inside each other to construct variable names.