Jelajahi Sumber

Update CASL to use nsupdate for DNS records (#48)

* Updated to use nsupdate for DNS records

* Updated formatting of dict

* Updating descriptive text

* Support for external DNS config

* Upgrading jinja2 to work correctly with latest templates

* Latest update for nsupdate

* Updated to use nsupdate for DNS records

* Updated formatting of dict

* Updating descriptive text

* Support for external DNS config

* Latest update for nsupdate

* Updated to support external public/private DNS server(s)

* Updated DNS server handling

* Updated DNS server handling

* Updated DNS server handling

* Eliminated the  from the sample inventories

* Updated sample inventory to point to 2 separate DNS servers for private/public

* Playbook clean-up

* Adding 'python-dns'

* splitting subscription manager calls to allow for a clean pre-install playbook
Øystein Bedin 7 tahun lalu
induk
melakukan
22e88c9ce8

+ 1 - 1
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

+ 3 - 0
roles/dns-server-detect/defaults/main.yml

@@ -0,0 +1,3 @@
+---
+
+external_nsupdate_keys: {}

+ 38 - 0
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
+

+ 6 - 6
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:

+ 2 - 2
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 }}"