New in version 2.6.
Parameter |
Choices/Defaults |
Configuration |
Comments |
---|---|---|---|
hosts
|
|
|
The
name key is a template used to generate hostnames based on the layers option. Each variable in the name is expanded to create a cartesian product of all possible layer combinations.The
parents are a list of parent groups that the host belongs to. Each parent item contains a name key, again expanded from the template, and an optional parents key that lists its parents.Parents can also contain
vars , which is a dictionary of vars that is then always set for that variable. This can provide easy access to the group name. E.g set an application variable that is set to the value of the application layer name. |
layers
|
|
|
A dictionary of layers, with the key being the layer name, used as a variable name in the
host name and parents keys. Each layer value is a list of possible values for that layer. |
# inventory.config file in YAML format
plugin: generator
strict: False
hosts:
name: "{{ operation }}-{{ application }}-{{ environment }}-runner"
parents:
- name: "{{ operation }}-{{ application }}-{{ environment }}"
parents:
- name: "{{ operation }}-{{ application }}"
parents:
- name: "{{ operation }}"
- name: "{{ application }}"
- name: "{{ application }}-{{ environment }}"
parents:
- name: "{{ application }}"
vars:
application: "{{ application }}"
- name: "{{ environment }}"
vars:
environment: "{{ environment }}"
- name: runner
layers:
operation:
- build
- launch
environment:
- dev
- test
- prod
application:
- web
- api
Hint
If you notice any issues in this documentation you can edit this document to improve it.