We have a set of servers shared between different instances of an application and would like the list of them to be a separate file, with other -- instance-specific inventories -- including it.
(I know, this can be done with dynamic inventories, but those are code and we'd like our server-listings to remain data, so to speak.)
With INI-inventories this is impossible, but with YAML-ones it is tantalizingly close. For example, this answer shows, how this can be done by adding a handler for !include
to Python's YAML-parser. One could then write:
all:
group1:
host1:
host2:
sharedservers: !include shared-servers.yaml
How can one add this functionality to one's own Ansible repository -- preferably, without implementing a whole new inventory-plugin (although inhering from Ansible's existing one would be Ok)?
children
to combine other groups which are located in other inventory files? – Debut