Skip to content

Instantly share code, notes, and snippets.

@knakayama
Created February 26, 2016 16:13
Show Gist options
  • Save knakayama/fd387cd0f058668031df to your computer and use it in GitHub Desktop.
Save knakayama/fd387cd0f058668031df to your computer and use it in GitHub Desktop.
- hosts: all
tasks:
- name: Create a group of all hosts by operating system
group_by: key={{ansible_distribution}}-{{ansible_distribution_version}}
# the following host group does not exist in inventory and was created by the group_by
# module.
- hosts: CentOS-6.2
tasks:
- name: ping all CentOS 6.2 hosts
ping:
- hosts: CentOS-6.3
tasks:
- name: ping all CentOS 6.3 hosts
ping:
- hosts: MacOSX-10.11.3
tasks:
- name: ping all MacOSX-10.11.3 hosts
ping:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment