- hosts: all gather_facts: true tasks: - name: group hosts by distribution group_by: key: '{{ ansible_os_family }}' changed_when: false - name: group hosts by virtualization group_by: key: >- {{ ansible_virtualization_type }}-{{ ansible_virtualization_role }} changed_when: false