Ansible - Child Group (Children|Group of Group)

Card Puncher Data Processing

About

A group of a group is called a child group.

The relation is defined through the use of the children key word.

Properties

  • Any host that is member of a child group is automatically a member of the parent group.
  • A child group’s variables will have higher precedence (override) a parent group’s variables.
  • Groups can have multiple parents and children, but not circular relationships.
  • Hosts can also be in multiple groups, but there will only be one instance of a host, merging the data from the multiple groups.

Management

Definition

Create a group of a group relation using :

  • the :children suffix in INI
  • or the children: entry in YAML

Example: The group parent1 has two children group1 and group2

  • ini
[childgroup2]
host1
host2

[childgroup1]
host2
host3

[parent1:children]
childgroup1
childgroup2
  • yaml
all:
    children:
        parent1:
            children:
                childgroup1:
                    host1:
                    host2:
                childgroup2:
                    host3:
                    host4:

Documentation / Reference





Discover More
Card Puncher Data Processing
Ansible - Group (Host Properties)

A host can have one or more group (tag). A group may have also have a group. See Groups don’t really survive outside of inventory and host matching because variables are defined to a specific host...
Card Puncher Data Processing
Ansible - Inventory

inventory is a file that define the following entity: the hosts the group of host the child relationship between group and variables (connection variable,...). The preferred practice in Ansible...
Card Puncher Data Processing
Playbook Variable

This article is variable inside a playbook, task, ... Single value Boolean Block of text Order...



Share this page:
Follow us:
Task Runner