summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorBogdan Dobrelya <bdobreli@redhat.com>2017-07-20 14:53:01 +0200
committerTomas Sedovic <tomas@sedovic.cz>2017-07-20 14:53:01 +0200
commit1975fb57b4ddee77eec6f849f2c7677e2ee3d6df (patch)
treef2ca419ffe5fc1353ddfa495be98f452acc9f738 /roles
parent018d410c4d441a8f66e8ac71d82f4ce46b508364 (diff)
downloadopenshift-1975fb57b4ddee77eec6f849f2c7677e2ee3d6df.tar.gz
openshift-1975fb57b4ddee77eec6f849f2c7677e2ee3d6df.tar.bz2
openshift-1975fb57b4ddee77eec6f849f2c7677e2ee3d6df.tar.xz
openshift-1975fb57b4ddee77eec6f849f2c7677e2ee3d6df.zip
Generate static inventory with shade inventory (#538)
* Autogenerate inventory/hosts when 'inventory: static' (Default), with the shade-inventory tool. * Drop unused anymore: openstack.py and associated GPL notes, an example static inventory, omit manual updates for the inventory DNS names in the deployment guide. * Switch openstack.py formatted inventory hostvars to the shade-inventory format (omit openstack.* from hostvars). * Populate node labels from inventory vars instead of the heat templates combined with inventory vars. * Add app (k8s minions) nodes group for primary node labels. Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
Diffstat (limited to 'roles')
-rw-r--r--roles/common/defaults/main.yml6
-rw-r--r--roles/dns-server-detect/tasks/main.yml20
-rw-r--r--roles/openstack-stack/meta/main.yml3
-rw-r--r--roles/openstack-stack/templates/heat_stack.yaml.j28
-rw-r--r--roles/static_inventory/meta/main.yml3
-rw-r--r--roles/static_inventory/templates/inventory.j210
6 files changed, 37 insertions, 13 deletions
diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml
new file mode 100644
index 000000000..8db591374
--- /dev/null
+++ b/roles/common/defaults/main.yml
@@ -0,0 +1,6 @@
+---
+openshift_cluster_node_labels:
+ app:
+ region: primary
+ infra:
+ region: infra
diff --git a/roles/dns-server-detect/tasks/main.yml b/roles/dns-server-detect/tasks/main.yml
index 183c0a0ca..cd775814f 100644
--- a/roles/dns-server-detect/tasks/main.yml
+++ b/roles/dns-server-detect/tasks/main.yml
@@ -2,35 +2,35 @@
- fail:
msg: 'Missing required private DNS server(s)'
when:
- - external_nsupdate_keys['private'] is undefined
- - hostvars[groups['dns'][0]] is undefined
+ - external_nsupdate_keys['private'] is undefined
+ - hostvars[groups['dns'][0]] is undefined
- fail:
msg: 'Missing required public DNS server(s)'
when:
- - external_nsupdate_keys['public'] is undefined
- - hostvars[groups['dns'][0]] is undefined
+ - external_nsupdate_keys['public'] is undefined
+ - hostvars[groups['dns'][0]] is undefined
- name: "Set the private DNS server to use the external value (if provided)"
set_fact:
private_dns_server: "{{ external_nsupdate_keys['private']['server'] }}"
when:
- - external_nsupdate_keys['private'] is defined
+ - external_nsupdate_keys['private'] is defined
- name: "Set the private DNS server to use the provisioned value"
set_fact:
- private_dns_server: "{{ hostvars[groups['dns'][0]].openstack.private_v4 }}"
+ private_dns_server: "{{ hostvars[groups['dns'][0]].private_v4 }}"
when:
- - private_dns_server is undefined
+ - private_dns_server is undefined
- name: "Set the public DNS server to use the external value (if provided)"
set_fact:
public_dns_server: "{{ external_nsupdate_keys['public']['server'] }}"
when:
- - external_nsupdate_keys['public'] is defined
+ - external_nsupdate_keys['public'] is defined
- name: "Set the public DNS server to use the provisioned value"
set_fact:
- public_dns_server: "{{ hostvars[groups['dns'][0]].openstack.public_v4 }}"
+ public_dns_server: "{{ hostvars[groups['dns'][0]].public_v4 }}"
when:
- - public_dns_server is undefined
+ - public_dns_server is undefined
diff --git a/roles/openstack-stack/meta/main.yml b/roles/openstack-stack/meta/main.yml
new file mode 100644
index 000000000..fdda41bb3
--- /dev/null
+++ b/roles/openstack-stack/meta/main.yml
@@ -0,0 +1,3 @@
+---
+dependencies:
+ - role: common
diff --git a/roles/openstack-stack/templates/heat_stack.yaml.j2 b/roles/openstack-stack/templates/heat_stack.yaml.j2
index 992f6257b..54941db06 100644
--- a/roles/openstack-stack/templates/heat_stack.yaml.j2
+++ b/roles/openstack-stack/templates/heat_stack.yaml.j2
@@ -610,7 +610,9 @@ resources:
type: node
subtype: app
node_labels:
- region: primary
+{% for k, v in openshift_cluster_node_labels.app.iteritems() %}
+ {{ k|e }}: {{ v|e }}
+{% endfor %}
image: {{ openstack_image }}
flavor: {{ node_flavor }}
key_name: {{ ssh_public_key }}
@@ -654,7 +656,9 @@ resources:
type: node
subtype: infra
node_labels:
- region: infra
+{% for k, v in openshift_cluster_node_labels.infra.iteritems() %}
+ {{ k|e }}: {{ v|e }}
+{% endfor %}
image: {{ openstack_image }}
flavor: {{ infra_flavor }}
key_name: {{ ssh_public_key }}
diff --git a/roles/static_inventory/meta/main.yml b/roles/static_inventory/meta/main.yml
new file mode 100644
index 000000000..fdda41bb3
--- /dev/null
+++ b/roles/static_inventory/meta/main.yml
@@ -0,0 +1,3 @@
+---
+dependencies:
+ - role: common
diff --git a/roles/static_inventory/templates/inventory.j2 b/roles/static_inventory/templates/inventory.j2
index ba806f286..9d129cf10 100644
--- a/roles/static_inventory/templates/inventory.j2
+++ b/roles/static_inventory/templates/inventory.j2
@@ -19,6 +19,11 @@
#[all:vars]
# For all group_vars, see ./group_vars/all.yml
+[infra_hosts:vars]
+openshift_node_labels={{ openshift_cluster_node_labels.infra | to_json | quote }}
+
+[app:vars]
+openshift_node_labels={{ openshift_cluster_node_labels.app | to_json | quote }}
# 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.
@@ -28,7 +33,6 @@ OSEv3
dns
[OSEv3:children]
-masters
nodes
etcd
@@ -54,6 +58,9 @@ nodes.{{ stack_name }}
[infra_hosts:children]
infra.{{ stack_name }}
+[app:children]
+nodes.{{ stack_name }}
+
[dns:children]
dns.{{ stack_name }}
@@ -62,6 +69,7 @@ dns.{{ stack_name }}
[etcd.{{ stack_name }}]
[infra.{{ stack_name }}]
[nodes.{{ stack_name }}]
+[app.{{ stack_name }}]
[dns.{{ stack_name }}]
# BEGIN Autogenerated groups