Based on hostname select variables.

31 views
Skip to first unread message

Dhanasekaran Anbalagan

unread,
Jun 22, 2015, 7:46:56 AM6/22/15
to ansible...@googlegroups.com
Hi Guys,

I am new to ansible world, Based on hostname I need to select variables and feed input to template file.

In my case :: I need to deploy app on multiple hosts, based on hostname I need to configure db_name and db_user and db_pass etc..

Please guide me, How to do this.


-Dhanasekaran.

Did I learn something today? If not, I wasted it.

J Hawkesworth

unread,
Jun 22, 2015, 8:45:35 AM6/22/15
to ansible...@googlegroups.com
There probably several ways of doing this.

To start with have a look at 'host_vars' - you can set variables for each machine in your inventory: http://docs.ansible.com/intro_inventory.html#host-variables

You will probably find very soon after that you want to set the same variables for groups of servers, so read about group vars as well (on the same page).

Hope this helps,

Jon
Reply all
Reply to author
Forward
0 new messages