manually define an inventory var when there is no inventory file

14 views
Skip to first unread message

Nicolas G

unread,
Sep 14, 2015, 3:49:35 PM9/14/15
to Ansible Project
Hi All,

I have the following template :

# web_cconfig.j2 :
web_servers={% for host in groups['web'] %} {{ host }}, {% endfor %}

This file is deployed in a role and using the server list from the inventory web group and working OK, the problem is when there are cases I need to use the same role but without specifying an inventory file , as for example when launching a new ec2 instacne and using using add_host module to configure this will throw an error the web group was not found...

Is it possible to manually set a inventory host var so I can use the same playbook ?
Reply all
Reply to author
Forward
0 new messages