summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--roles/common/pre_tasks/pre_tasks.yml2
-rw-r--r--roles/dns-server-detect/defaults/main.yml3
-rw-r--r--roles/dns-server-detect/tasks/main.yml38
-rw-r--r--roles/openstack-stack/templates/heat_stack.yaml.j212
-rw-r--r--roles/openstack-stack/test/stack-create-test.yml4
5 files changed, 50 insertions, 9 deletions
diff --git a/roles/common/pre_tasks/pre_tasks.yml b/roles/common/pre_tasks/pre_tasks.yml
index cc4e64a0f..c5e79e89c 100644
--- a/roles/common/pre_tasks/pre_tasks.yml
+++ b/roles/common/pre_tasks/pre_tasks.yml
@@ -22,7 +22,7 @@
- name: Updating DNS domain to include env_id (if not empty)
set_fact:
- full_dns_domain: "{{ (env_id|trim == '') | ternary(dns_domain, env_id + '.' + dns_domain) }}"
+ full_dns_domain: "{{ (env_id|trim == '') | ternary(public_dns_domain, env_id + '.' + public_dns_domain) }}"
delegate_to: localhost
- name: Set the APP domain for OpenShift use
diff --git a/roles/dns-server-detect/defaults/main.yml b/roles/dns-server-detect/defaults/main.yml
new file mode 100644
index 000000000..58bd861cd
--- /dev/null
+++ b/roles/dns-server-detect/defaults/main.yml
@@ -0,0 +1,3 @@
+---
+
+external_nsupdate_keys: {}
diff --git a/roles/dns-server-detect/tasks/main.yml b/roles/dns-server-detect/tasks/main.yml
new file mode 100644
index 000000000..e8dd0acf0
--- /dev/null
+++ b/roles/dns-server-detect/tasks/main.yml
@@ -0,0 +1,38 @@
+---
+
+- fail:
+ msg: 'Missing required private DNS server(s)'
+ when:
+ - 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
+
+- 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
+
+- name: "Set the private DNS server to use the provisioned value"
+ set_fact:
+ private_dns_server: "{{ hostvars[groups['dns'][0]].openstack.private_v4 }}"
+ when:
+ - 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
+
+- name: "Set the public DNS server to use the provisioned value"
+ set_fact:
+ public_dns_server: "{{ hostvars[groups['dns'][0]].openstack.public_v4 }}"
+ when:
+ - public_dns_server is undefined
+
diff --git a/roles/openstack-stack/templates/heat_stack.yaml.j2 b/roles/openstack-stack/templates/heat_stack.yaml.j2
index c367aabe7..09b62cba7 100644
--- a/roles/openstack-stack/templates/heat_stack.yaml.j2
+++ b/roles/openstack-stack/templates/heat_stack.yaml.j2
@@ -381,7 +381,7 @@ resources:
params:
cluster_id: {{ stack_name }}
k8s_type: etcd
- cluster_env: {{ dns_domain }}
+ cluster_env: {{ public_dns_domain }}
cluster_id: {{ stack_name }}
group:
str_replace:
@@ -421,7 +421,7 @@ resources:
params:
cluster_id: {{ stack_name }}
k8s_type: lb
- cluster_env: {{ dns_domain }}
+ cluster_env: {{ public_dns_domain }}
cluster_id: {{ stack_name }}
group:
str_replace:
@@ -461,7 +461,7 @@ resources:
params:
cluster_id: {{ stack_name }}
k8s_type: master
- cluster_env: {{ dns_domain }}
+ cluster_env: {{ public_dns_domain }}
cluster_id: {{ stack_name }}
group:
str_replace:
@@ -505,7 +505,7 @@ resources:
cluster_id: {{ stack_name }}
k8s_type: node
subtype: app
- cluster_env: {{ dns_domain }}
+ cluster_env: {{ public_dns_domain }}
cluster_id: {{ stack_name }}
group:
str_replace:
@@ -548,7 +548,7 @@ resources:
cluster_id: {{ stack_name }}
k8s_type: node
subtype: infra
- cluster_env: {{ dns_domain }}
+ cluster_env: {{ public_dns_domain }}
cluster_id: {{ stack_name }}
group:
str_replace:
@@ -591,7 +591,7 @@ resources:
params:
cluster_id: {{ stack_name }}
k8s_type: dns
- cluster_env: {{ dns_domain }}
+ cluster_env: {{ public_dns_domain }}
cluster_id: {{ stack_name }}
group:
str_replace:
diff --git a/roles/openstack-stack/test/stack-create-test.yml b/roles/openstack-stack/test/stack-create-test.yml
index 94e312ee3..6cbd7ff30 100644
--- a/roles/openstack-stack/test/stack-create-test.yml
+++ b/roles/openstack-stack/test/stack-create-test.yml
@@ -3,8 +3,8 @@
roles:
- role: openstack-stack
stack_name: test-stack
- dns_domain: "{{ openstack_dns_domain }}"
- dns_nameservers: "{{ openstack_nameservers }}"
+ dns_domain: "{{ public_dns_domain }}"
+ dns_nameservers: "{{ public_dns_nameservers }}"
subnet_prefix: "{{ openstack_subnet_prefix }}"
ssh_public_key: "{{ openstack_ssh_public_key }}"
openstack_image: "{{ openstack_default_image_name }}"