cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor
Commander Commander
Commander
  • 160 Views

Ansible Inventory File

How would the following information be formatted in an Inventory file for Ansible:

amh[1:2] Hosts info: amh1.example.com IP: 192.168.10.10 MAC: 00:15:5d:74:0f:07 amh2.example.com IP: 192.168.10.11 MAC: 00:15:5d:74:0f:08

 

 

Trevor "Red Hat Evangelist" Chandler
Labels (4)
3 Replies
Chetan_Tiwary_
Community Manager
Community Manager
  • 121 Views

@Trevor 

all:
  children:
    amh:
      hosts:
        amh1:
          ansible_host: 192.168.10.10
          mac_address: "00:15:5d:74:0f:07"
        amh2:
          ansible_host: 192.168.10.11
          mac_address: "00:15:5d:74:0f:08"
Trevor
Commander Commander
Commander
  • 115 Views

Chetan,

I like what I see!

Regarding the "ansible_host" variable, I noticed that you
chose to use the IP address of each host, instead of its FQDN. 
Any particular reason you chose that route?

Trevor "Red Hat Evangelist" Chandler
Chetan_Tiwary_
Community Manager
Community Manager
  • 92 Views

@Trevor totaly depends upon your setup - if you trust your DNS fqdn is fine ( and it is easier to read the fqdn for humans , I agree ) else you can mention the IP :

Chetan_Tiwary__0-1757962963678.png

https://docs.ansible.com/ansible/latest/getting_started/get_started_inventory.html 

https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#behavioral-parameters 

0 Kudos
Join the discussion
You must log in to join this conversation.