Note
This module is part of ansible-base and included in all Ansible installations. In most cases, you can use the short module name yaml even without specifying the collections: keyword. Despite that, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 2.4: of ansible.builtin
all group and contain hosts/vars/children entries.| Parameter | Choices/Defaults | Configuration | Comments |
|---|---|---|---|
| yaml_extensions list / elements=string | Default: [".yaml", ".yml", ".json"] | ini entries: [defaults] [inventory_plugin_yaml] env:ANSIBLE_YAML_FILENAME_EXT env:ANSIBLE_INVENTORY_PLUGIN_EXTS | list of 'valid' extensions for files containing YAML |
Note
all group inside the inventory file, the all group must be the first entry in the file.all: # keys must be unique, i.e. only one 'hosts' per group
hosts:
test1:
test2:
host_var: value
vars:
group_all_var: value
children: # key order does not matter, indentation does
other_group:
children:
group_x:
hosts:
test5 # Note that one machine will work without a colon
#group_x:
# hosts:
# test5 # But this won't
# test7 #
group_y:
hosts:
test6: # So always use a colon
vars:
g2_var2: value3
hosts:
test4:
ansible_host: 127.0.0.1
last_group:
hosts:
test1 # same host as above, additional group membership
vars:
group_last_var: value
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ansible/builtin/yaml_inventory.html