I’m running Ansible 1.4.4 which comes with Ubuntu 12.04 LTS. I’m getting weird results when trying to get host facts.
If I have:
- debug: var=hostvars[inventory_hostname]
I get the all the information I’d expect, including:
ok: [test.example.com] => {
   "hostvars[inventory_hostname]": {
…
"ansible_eth0": {
           "active": true,
           "device": "eth0",
           "ipv4": {
               "address": “192.168.1.1",
               "netmask": "255.255.255.0",
               "network": “192.168.1.254"
           },
….
but if I have:
- debug: var=hostvars[inventory_hostname]['ansible_eth0’]
ok: [test.example.com] => {
   "hostvars[inventory_hostname][ansible_eth0]": "{{ hostvars[inventory_hostname][ansible_eth0] }}",
   "item": "”
}
i.e. Nothing!
I also tried
- debug: msg={{hostvars[inventory_hostname]['ansible_eth0’]}}
and got the same result.
I did a google and didn’t find anything promising.
Any suggestions as to what I’m doing wrong?
Thanks,
GTG