summaryrefslogtreecommitdiffstats
path: root/roles/static_inventory/templates
diff options
context:
space:
mode:
authorBogdan Dobrelya <bdobreli@redhat.com>2017-07-17 14:05:42 +0200
committerTomas Sedovic <tomas@sedovic.cz>2017-07-17 14:05:42 +0200
commita0d2dd9d29e8622e739870baf172f2b8a7e9c6a0 (patch)
treeaf6498151b459ab00685dd4f47b0286f2f90e9a8 /roles/static_inventory/templates
parentbef7807177915fe4861fcef5c4a78884f49b3b0e (diff)
downloadopenshift-a0d2dd9d29e8622e739870baf172f2b8a7e9c6a0.tar.gz
openshift-a0d2dd9d29e8622e739870baf172f2b8a7e9c6a0.tar.bz2
openshift-a0d2dd9d29e8622e739870baf172f2b8a7e9c6a0.tar.xz
openshift-a0d2dd9d29e8622e739870baf172f2b8a7e9c6a0.zip
Add a role to generate a static inventory (#540)
* Add the static-inventory role that configures the inventory/hosts file by the given path, or creates it for you. Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
Diffstat (limited to 'roles/static_inventory/templates')
-rw-r--r--roles/static_inventory/templates/inventory.j276
1 files changed, 76 insertions, 0 deletions
diff --git a/roles/static_inventory/templates/inventory.j2 b/roles/static_inventory/templates/inventory.j2
new file mode 100644
index 000000000..aa87e2b11
--- /dev/null
+++ b/roles/static_inventory/templates/inventory.j2
@@ -0,0 +1,76 @@
+# BEGIN Autogenerated hosts
+{% for host in groups['all'] %}
+{% if hostvars[host].get('ansible_connection', '') == 'local' %}
+{{ host }} ansible_connection=local
+{% else %}
+
+{{ host }}{% if 'ansible_host' in hostvars[host]
+%} ansible_host={{ hostvars[host]['ansible_host'] }}{% endif %}
+{% if 'private_v4' in hostvars[host]
+%} private_v4={{ hostvars[host]['private_v4'] }}{% endif %}
+{% if 'public_v4' in hostvars[host]
+%} public_v4={{ hostvars[host]['public_v4'] }}{% endif %}
+{% if 'ansible_private_key_file' in hostvars[host]
+%} ansible_private_key_file={{ hostvars[host]['ansible_private_key_file'] }}{% endif %}
+
+{% endif %}
+{% endfor %}
+# END autogenerated hosts
+
+#[all:vars]
+# For all group_vars, see ./group_vars/all.yml
+
+# Create an OSEv3 group that contains the master, nodes, etcd, and lb groups.
+# The lb group lets Ansible configure HAProxy as the load balancing solution.
+# Comment lb out if your load balancer is pre-configured.
+[cluster_hosts:children]
+OSEv3
+dns
+
+[OSEv3:children]
+masters
+nodes
+etcd
+
+# Set variables common for all OSEv3 hosts
+#[OSEv3:vars]
+
+# For OSEv3 normal group vars, see ./group_vars/OSEv3.yml
+
+# Host Groups
+
+[masters:children]
+masters.{{ stack_name }}
+
+[etcd:children]
+etcd.{{ stack_name }}
+
+[nodes:children]
+masters
+infra.{{ stack_name }}
+nodes.{{ stack_name }}
+
+[infra_hosts:children]
+infra.{{ stack_name }}
+
+[dns:children]
+dns.{{ stack_name }}
+
+# Empty placeholders for all groups of the cluster nodes
+[masters.{{ stack_name }}]
+[etcd.{{ stack_name }}]
+[infra.{{ stack_name }}]
+[nodes.{{ stack_name }}]
+[dns.{{ stack_name }}]
+
+# BEGIN Autogenerated groups
+{% for group in groups %}
+{% if group not in ['ungrouped', 'all'] %}
+[{{ group }}]
+{% for host in groups[group] %}
+{{ host }}
+{% endfor %}
+
+{% endif %}
+{% endfor %}
+# END Autogenerated groups