Hi everyone!

We currently use *ansible_host* variable and define an alias for the hosts 
we use as follows:

Inventory file

[my_jboss_servers]
jboss_server1 ansible_host=myhostnameABC
jboss_server2 ansible_host=myhostnameEFG
jboss_server3 ansible_host=myhostnameHIJ
jboss_server4 ansible_host=myhostnameKLM



The reason for this is because hosts might change from time to time and 
since we have host-specific variables and files, it's just easier to keep 
using the same alias so we don't have to change any file names in our 
repository however this also has a disadvantage as it might get confusing 
if we start removing and adding hosts since the ansible-playbook console 
output displays only the alias, not the actual host, see:

$ ansible-playbook myplaybook.yml -i inventory/my_inventory

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [jboss_server1]
ok: [jboss_server2]
ok: [jboss_server3]
ok: [jboss_server4]

TASK [Task 1 : Create home directory if it does not exist] *******************
ok: [jboss_server1]
ok: [jboss_server2]
ok: [jboss_server3]
ok: [jboss_server4]


My questions are:

   1. Is there any ansible best-practice on how to handle this scenario?
   2. Is there any way I can display the actual hostname, not the alias in 
   the console output?


Thanks in advance for your help / guidance on this!

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c300583a-eee8-418e-b5fe-d1738c544c48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to