generator – Uses Jinja2 to construct hosts and groups from patterns¶
New in version 2.6.
Synopsis¶
Uses a YAML configuration file with a valid YAML or
.config
extension to define var expressions and group conditionalsCreate a template pattern that describes each host, and then use independent configuration layers
Every element of every layer is combined to create a host for every layer combination
Parent groups can be defined with reference to hosts and other groups using the same template variables
Parameters¶
Examples¶
# 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
Status¶
This inventory is not guaranteed to have a backwards compatible interface. [preview]
This inventory is maintained by the Ansible Community. [community]
Authors¶
UNKNOWN
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.