Based on hostname select variables.

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.

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