Devendra Gogate:
Hello All,
I am trying get my hand dirty on writing basic Inventory file in yml format.
I know that hosts names in the Inventory file must be unique, no duplicates allowed, but other than hosts, can I use similar items in the hierarchy?
eg. in below file I am using the same items Network/Storage/Servers again and again.
Is this correct?
Al West:
Yes, in an Ansible inventory file in YAML format, it is perfectly fine to reuse the same group or variable names at different levels of the hierarchy, as you are doing with Network
, Storage
, and Servers
. These are considered to be child groups under each environment (DEV
, UAT
, PROD
, DR
), and Ansible allows them to be reused because they are scoped within their respective parent group.
Devendra Gogate:
Thank you for the confirmation… !!!