summaryrefslogtreecommitdiff
path: root/inventory
diff options
context:
space:
mode:
authorMichael DeHaan <michael.dehaan@gmail.com>2014-09-26 10:13:26 -0400
committerMichael DeHaan <michael.dehaan@gmail.com>2014-09-26 10:13:26 -0400
commit417309a626e39396196a4abc6208c9f6db158f9d (patch)
treef6c39edc1c4f9777295bf3ccf965618c0d0b3937 /inventory
parent8cdea3edf020c01e7659e97b7bd8b857974fba7f (diff)
downloadansible-modules-core-417309a626e39396196a4abc6208c9f6db158f9d.tar.gz
Restructuring.
Diffstat (limited to 'inventory')
-rw-r--r--inventory/add_host36
-rw-r--r--inventory/group_by25
2 files changed, 61 insertions, 0 deletions
diff --git a/inventory/add_host b/inventory/add_host
new file mode 100644
index 00000000..4fd4e1eb
--- /dev/null
+++ b/inventory/add_host
@@ -0,0 +1,36 @@
+# -*- 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:
+ aliases: [ 'hostname', 'host' ]
+ 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', 'group' ]
+ description:
+ - The groups to add the hostname to, comma separated.
+ required: false
+author: Seth Vidal
+'''
+
+EXAMPLES = '''
+# add host to group 'just_created' with variable foo=42
+- add_host: name={{ ip_from_ec2 }} groups=just_created foo=42
+
+# add a host with a non-standard port local to your machines
+- add_host: name={{ new_ip }}:{{ new_port }}
+
+# add a host alias that we reach through a tunnel
+- 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..d09552e6
--- /dev/null
+++ b/inventory/group_by
@@ -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 }}
+'''