From e2419cbf9df001901eb6e8fa9fc0dd7cb2ff3c80 Mon Sep 17 00:00:00 2001 From: Jeroen Hoekx Date: Sat, 27 Oct 2012 19:47:47 +0200 Subject: [PATCH] Add a group_by action plugin. --- group_by | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 group_by diff --git a/group_by b/group_by new file mode 100644 index 00000000000..4a1609ec553 --- /dev/null +++ b/group_by @@ -0,0 +1,23 @@ +# -*- 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 +examples: + - description: Create groups based on the machine architecture + code: group_by key=${ansible_machine} + - description: Create groups like 'kvm-host' + code: group_by key=${ansible_virtualization_type}-${ansible_virtualization_role} +notes: + - Spaces in group names are converted to dashes '-'. +'''