summaryrefslogtreecommitdiff
path: root/inventory/group_by.py
diff options
context:
space:
mode:
authorMichael DeHaan <michael.dehaan@gmail.com>2014-09-26 10:37:56 -0400
committerMichael DeHaan <michael.dehaan@gmail.com>2014-09-26 10:37:56 -0400
commitc8e1a2077ed356fb893cd9886f758ac3d284e6b9 (patch)
tree2c8238e5cabfd8f0f088707a4ef70f5dade57bea /inventory/group_by.py
parent417309a626e39396196a4abc6208c9f6db158f9d (diff)
downloadansible-modules-core-c8e1a2077ed356fb893cd9886f758ac3d284e6b9.tar.gz
file extensions!
Diffstat (limited to 'inventory/group_by.py')
-rw-r--r--inventory/group_by.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/inventory/group_by.py b/inventory/group_by.py
new file mode 100644
index 00000000..d09552e6
--- /dev/null
+++ b/inventory/group_by.py
@@ -0,0 +1,25 @@
+# -*- mode: python -*-
+
+DOCUMENTATION = '''
+---
+module: group_by
+short_description: Create Ansible groups based on facts
+description:
+ - Use facts to create ad-hoc groups that can be used later in a playbook.
+version_added: "0.9"
+options:
+ key:
+ description:
+ - The variables whose values will be used as groups
+ required: true
+author: Jeroen Hoekx
+notes:
+ - Spaces in group names are converted to dashes '-'.
+'''
+
+EXAMPLES = '''
+# 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 }}
+'''