Use invenvtory_hosts in templates

16 views
Skip to first unread message

Sagayaraj A

unread,
Jul 28, 2015, 7:55:00 AM7/28/15
to Ansible Project
Hi All,

I'm trying to make use of the values in the inventory file to generate a configuration file out a of a Jinja template. Similarly I'm not able to use the ansible facts as well in the Jinja template (ex: { ansible_hostanme } ).

Is this supported/possible?
Is there something that I can do to make this work?

Appreciate your comments/help :)


Regards,
Sagayaraj

Brian Coca

unread,
Jul 28, 2015, 8:32:24 AM7/28/15
to Ansible Project
its double mustaches:

{{ ansible_hostanme }}

also make sure you have gathered facts.




--
Brian Coca

Sagayaraj A

unread,
Jul 28, 2015, 11:03:14 AM7/28/15
to Ansible Project, bc...@ansible.com
thank you - that did the trick
Reply all
Reply to author
Forward
0 new messages