summaryrefslogtreecommitdiff
path: root/inventory
diff options
context:
space:
mode:
authorMichael DeHaan <michael@ansibleworks.com>2013-04-28 15:03:45 -0400
committerMichael DeHaan <michael@ansibleworks.com>2013-04-28 15:03:45 -0400
commitcd97a4cb1459141cb5d4a0f28463dd39650caa68 (patch)
tree04e0b838e7c412f1c939b6a9d0754df2e49d0da4 /inventory
parent73d2a38e3a61e96508ae514c37e56a105268d52c (diff)
downloadansible-modules-core-cd97a4cb1459141cb5d4a0f28463dd39650caa68.tar.gz
Allow modules to be categorized, and also sort them when generating the documentation.
Diffstat (limited to 'inventory')
-rw-r--r--inventory/add_host29
-rw-r--r--inventory/group_by23
2 files changed, 52 insertions, 0 deletions
diff --git a/inventory/add_host b/inventory/add_host
new file mode 100644
index 00000000..b8204a52
--- /dev/null
+++ b/inventory/add_host
@@ -0,0 +1,29 @@
+# -*- mode: python -*-
+
+DOCUMENTATION = '''
+---
+module: add_host
+short_description: add a host (and alternatively a group) to the ansible-playbook in-memory inventory
+description:
+ - Use variables to create new hosts and groups in inventory for use in later plays of the same playbook.
+ Takes variables so you can define the new hosts more fully.
+version_added: "0.9"
+options:
+ name:
+ description:
+ - The hostname/ip of the host to add to the inventory, can include a colon and a port number.
+ required: true
+ groups:
+ aliases: [ 'groupname' ]
+ description:
+ - The groups to add the hostname to, comma separated.
+ required: false
+author: Seth Vidal
+examples:
+ - description: add host to group 'just_created' with variable foo=42
+ code: add_host hostname=${ip_from_ec2} groups=just_created foo=42
+ - description: add a host with a non-standard port local to your machines
+ code: add_host hostname='${new_ip}:${new_port}'
+ - description: add a host alias that we reach through a tunnel
+ code: add_host hostname=${new_ip} ansible_ssh_host=${inventory_hostname} ansible_ssh_port=${new_port}'
+'''
diff --git a/inventory/group_by b/inventory/group_by
new file mode 100644
index 00000000..a8e6b835
--- /dev/null
+++ b/inventory/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 '-'.
+'''