[INF-63] Fix dns configuration
In the OS image, systemd-resolved is used as local dns manager,
therefore in this commit we config the DNS via the
corresponding configuration file: /etc/systemd/resolved.conf
Removed the changes to network interfaces file as this dns manager
will not respect that. Removed also to the changes to resolve.conf
as the file will be managed by the dns manager.
At the same time, restore the idf back to support multiple dns
servers as a list.
Also, to make the host server be less resource demanding,
modified the pdf file with reduced hard disk and memory.
Change-Id: I0ce7beb644bb5e2757bb62da46aca6d3f4e86e1f
diff --git a/engine/infra/bifrost/playbooks/roles/install-configure-bifrost/templates/bifrost-deploy.yml.j2 b/engine/infra/bifrost/playbooks/roles/install-configure-bifrost/templates/bifrost-deploy.yml.j2
index d78e6bf..daf3800 100644
--- a/engine/infra/bifrost/playbooks/roles/install-configure-bifrost/templates/bifrost-deploy.yml.j2
+++ b/engine/infra/bifrost/playbooks/roles/install-configure-bifrost/templates/bifrost-deploy.yml.j2
@@ -10,7 +10,7 @@
multinode_testing: true
write_interfaces_file: true
ipv4_gateway: "{{ idf.net_config.public.gateway }}"
- ipv4_nameserver: "{{ idf.net_config.public.dns }}"
+ ipv4_nameserver: "{{ idf.net_config.public.dns | list }}"
inventory_dhcp: true
inventory_dhcp_static_ip: true
wait_for_node_deploy: true
diff --git a/engine/installer/kubespray/playbooks/roles/configure-targethosts/tasks/configure-network-ubuntu16.yml b/engine/installer/kubespray/playbooks/roles/configure-targethosts/tasks/configure-network-ubuntu16.yml
index 7c21261..18ca7ef 100644
--- a/engine/installer/kubespray/playbooks/roles/configure-targethosts/tasks/configure-network-ubuntu16.yml
+++ b/engine/installer/kubespray/playbooks/roles/configure-targethosts/tasks/configure-network-ubuntu16.yml
@@ -50,10 +50,10 @@
src: "{{ distribution }}.interface.j2"
dest: "/etc/network/interfaces.d/{{ item.name }}.cfg"
with_items:
- - { name: "{{ admin_if }}", vlan_id: "{{ (admin_vlan == 'native') | ternary(omit, admin_vlan) }}", nw: "{{ admin_nw }}", ip: "{{ admin_ip }}", gw: "{{ admin_gw }}", dns: "{{ admin_dns }}" }
- - { name: "{{ public_if }}", vlan_id: "{{ (public_vlan == 'native') | ternary(omit, public_vlan) }}", nw: "{{ public_nw }}", ip: "{{ public_ip }}", gw: "{{ public_gw }}", dns: "{{ public_dns }}" }
- - { name: "{{ mgmt_if }}", vlan_id: "{{ (mgmt_vlan == 'native') | ternary(omit, mgmt_vlan) }}", nw: "{{ mgmt_nw }}", ip: "{{ mgmt_ip }}", gw: "{{ mgmt_gw }}", dns: "{{ mgmt_dns }}" }
- - { name: "{{ neutron_if }}", vlan_id: "{{ (neutron_vlan == 'native') | ternary(omit, neutron_vlan) }}", nw: "{{ neutron_nw }}", ip: "{{ neutron_ip }}", gw: "{{ neutron_gw }}", dns: "{{ neutron_dns }}" }
+ - { name: "{{ admin_if }}", vlan_id: "{{ (admin_vlan == 'native') | ternary(omit, admin_vlan) }}", nw: "{{ admin_nw }}", ip: "{{ admin_ip }}", gw: "{{ admin_gw }}"}
+ - { name: "{{ public_if }}", vlan_id: "{{ (public_vlan == 'native') | ternary(omit, public_vlan) }}", nw: "{{ public_nw }}", ip: "{{ public_ip }}", gw: "{{ public_gw }}"}
+ - { name: "{{ mgmt_if }}", vlan_id: "{{ (mgmt_vlan == 'native') | ternary(omit, mgmt_vlan) }}", nw: "{{ mgmt_nw }}", ip: "{{ mgmt_ip }}", gw: "{{ mgmt_gw }}"}
+ - { name: "{{ neutron_if }}", vlan_id: "{{ (neutron_vlan == 'native') | ternary(omit, neutron_vlan) }}", nw: "{{ neutron_nw }}", ip: "{{ neutron_ip }}", gw: "{{ neutron_gw }}"}
loop_control:
label: "{{ item.name }}"
@@ -67,13 +67,15 @@
- "{{ mgmt_if }}"
- "{{ neutron_if }}"
-# TODO: The content of /etc/resolv.conf seems to be set randomly
-# after network configuration is applied so this is yet another
-# DNS workaround to ensure we have the correct nameserver in it
-- name: Ensure resolv.conf has the correct content
+- name: Ensure systemd resolved.conf has the correct content
lineinfile:
- path: /etc/resolv.conf
- regexp: "^nameserver "
- line: "nameserver {{ idf.net_config.public.dns }}"
+ path: /etc/systemd/resolved.conf
+ regexp: "^#?DNS=.*$"
+ line: "DNS={{ idf.net_config.public.dns | join(' ')}}"
+
+- name: Restart systemd-resolved service
+ service:
+ name: "systemd-resolved"
+ state: restarted
# vim: set ts=2 sw=2 expandtab:
diff --git a/engine/installer/kubespray/playbooks/roles/configure-targethosts/templates/ubuntu16.interface.j2 b/engine/installer/kubespray/playbooks/roles/configure-targethosts/templates/ubuntu16.interface.j2
index 206587d..e9c68e5 100644
--- a/engine/installer/kubespray/playbooks/roles/configure-targethosts/templates/ubuntu16.interface.j2
+++ b/engine/installer/kubespray/playbooks/roles/configure-targethosts/templates/ubuntu16.interface.j2
@@ -13,7 +13,4 @@
{% if item.gw %}
gateway {{ item.gw | ipaddr('address') }}
{% endif %}
-{% if item.dns %}
- dns-nameservers {{ item.dns }}
-{% endif %}
{% endif %}
diff --git a/engine/installer/kubespray/playbooks/roles/configure-targethosts/vars/main.yml b/engine/installer/kubespray/playbooks/roles/configure-targethosts/vars/main.yml
index 516b95d..466cd02 100644
--- a/engine/installer/kubespray/playbooks/roles/configure-targethosts/vars/main.yml
+++ b/engine/installer/kubespray/playbooks/roles/configure-targethosts/vars/main.yml
@@ -18,10 +18,6 @@
{%- if idf.net_config.admin.gateway is defined -%}
{{ idf.net_config.admin.gateway }}
{%- endif -%}
-admin_dns: >-
- {%- if idf.net_config.admin.dns is defined -%}
- {{ idf.net_config.admin.dns }}
- {%- endif -%}
# public network information
public_mac: "{{ node_interfaces[idf.net_config.public.interface].mac_address }}"
@@ -42,10 +38,6 @@
{%- if idf.net_config.public.gateway is defined -%}
{{ idf.net_config.public.gateway }}
{%- endif -%}
-public_dns: >-
- {%- if idf.net_config.public.dns is defined -%}
- {{ idf.net_config.public.dns }}
- {%- endif -%}
# mgmt network information
mgmt_mac: "{{ node_interfaces[idf.net_config.mgmt.interface].mac_address }}"
@@ -66,10 +58,6 @@
{%- if idf.net_config.mgmt.gateway is defined -%}
{{ idf.net_config.mgmt.gateway }}
{%- endif -%}
-mgmt_dns: >-
- {%- if idf.net_config.mgmt.dns is defined -%}
- {{ idf.net_config.mgmt.dns }}
- {%- endif -%}
# neutron network information
neutron_mac: "{{ node_interfaces[idf.net_config.neutron.interface].mac_address }}"
@@ -90,9 +78,5 @@
{%- if idf.net_config.neutron.gateway is defined -%}
{{ idf.net_config.neutron.gateway }}
{%- endif -%}
-neutron_dns: >-
- {%- if idf.net_config.neutron.dns is defined -%}
- {{ idf.net_config.neutron.dns }}
- {%- endif -%}
# vim: set ts=2 sw=2 expandtab:
diff --git a/engine/var/idf.yml b/engine/var/idf.yml
index f2efba6..c18f0eb 100644
--- a/engine/var/idf.yml
+++ b/engine/var/idf.yml
@@ -28,8 +28,9 @@
network: 10.2.0.0
mask: 24
gateway: 10.2.0.1
- # TODO: fix this so we can provide list of dns instead of single one
- dns: 8.8.8.8
+ dns:
+ 8.8.8.8
+ 8.8.4.4
mgmt:
interface: 2
network: 10.3.0.0
diff --git a/engine/var/pdf.yml b/engine/var/pdf.yml
index 8c56005..629ee2e 100644
--- a/engine/var/pdf.yml
+++ b/engine/var/pdf.yml
@@ -42,10 +42,10 @@
cpus: 4
cpu_cflags: host-model
cores: 4
- memory: 8G
+ memory: 4G
disks: &disks
- name: disk1
- disk_capacity: 80G
+ disk_capacity: 20G
disk_type: hdd
disk_interface: sata
disk_rotation: