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

Ansible Inventory Definition - INI vs YAML Format

I need to write an inventory definition, in INI and YAML format, based on the following:

- "Carribean" group
- "Barbados" and "Jamaica" subgroups, inside the "Carribean" group
- 3 hosts (host1, host2, host3) inside the "Barbados" subgroup
- 1 hosts (host4) inside the "Jamaica" subgroup


What does the syntax look like for each format?

Trevor "Red Hat Evangelist" Chandler
Labels (1)
0 Kudos
2 Replies
Ad_astra
Flight Engineer Flight Engineer
Flight Engineer
  • 90 Views

Hi there

Good question. My answer as follows:

For the YAML formatted inventory:

---
Barbados:
  hosts:
    host1
    host2
    host3

Jamaica:
  hosts:
    host4

Carribean:
  children:
    Barbados:
    Jamaica:

For the INI formatted inventory:

[Barbados]
host1
host2
host3
[Jamaica]
host4
[Carribean:children]
Barbados
Jamaica

I use the INI format for day to day tasks as that is what I am more familiar with!

Thanks 

0 Kudos
Trevor
Commander Commander
Commander
  • 89 Views

Ad_astra, thanks for getting things kicked off with your respsonse!

 

Trevor "Red Hat Evangelist" Chandler
Join the discussion
You must log in to join this conversation.