ansible / ansible.builtin / v2.4.3.0-1 / module / group_by Create Ansible groups based on facts | "added in version" 0.9 of ansible.builtin" Authors: Jeroen Hoekx (@jhoekx) stableinterface | supported by coreansible.builtin.group_by (v2.4.3.0-1) — module
pip
Install with pip install ansible==2.4.3.0.post1
Use facts to create ad-hoc groups that can be used later in a playbook.
This module is also supported for Windows targets.
# Create groups based on the machine architecture - group_by: key: machine_{{ ansible_machine }}
# Create groups like 'kvm-host' - group_by: key: virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }}
# Create nested groups - group_by: key: el{{ ansible_distribution_major_version }}-{{ ansible_architecture }} parents: - el{{ ansible_distribution_major_version }}
key: description: - The variables whose values will be used as groups required: true parents: default: all description: - The list of the parent groups required: false version_added: '2.4' version_added_collection: ansible.builtin