Hi Richard,

I'm sure there's more than one way to skin a cat, here, but I set up my 
hosts file thusly, and it does the job:

[rails]
rails0 ansible_ssh_host=xxx.xxx.xxx.xxx
rails1 ansible_ssh_host=xxx.xxx.xxx.xxx
rails2 ansible_ssh_host=xxx.xxx.xxx.xxx


I believe when doing this, you're just aliasing the hostname for the ip 
number.

On Wednesday, November 25, 2015 at 11:45:25 AM UTC-5, richard kappler wrote:
>
> New to Ansible here, and have a question on using an inventory_hostname 
> variable.
>
> I have a playbook that deploys an add-on to numerous servers, using an 
> inventory list of IP addresses setup as so:
>
> [servers01]
> xxx.xxx.xxx.xxx
> yyy.yyy.yyy.yyy
>
> [servers02]
> zzz.zzz.zzz.zzz
>
> and so on.
>
> One of the plays edits a configuration file with:
>
> - name: edit inputs.conf for server name
>   replace:
>         dest=/path/to/inputs/conf
>         regexp='PLACEHOLDER'
>         replace="{{ inventory_hostname }}"
>         backup=no
>
> This playbook has been tested in our local test environment and works 
> well, but it has now been decided to use a text hostname instead of an IP 
> address. I have updated the inventory file as follows:
>
> [servers01]
> hostname1 xxx.xxx.xxx.xxx
> hostname2 yyy.yyy.yyy.yyy
>
> [servers02]
> hostname3 zzz.zzz.zzz.zzz
>
> and so on.
>
> My question is, does inventory_hostname pull out hostname1 or still pull 
> out the IP address?
>
> regards, Richard
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3322529f-d89e-4f43-874c-ca2100a9114b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to