xci: bifrost: Respect IDF DNS details during node configuration 93/64693/3
authorMarkos Chandras <mchandras@suse.de>
Wed, 7 Nov 2018 16:31:08 +0000 (16:31 +0000)
committerMarkos Chandras <mchandras@suse.de>
Thu, 8 Nov 2018 09:23:57 +0000 (09:23 +0000)
The IDF files contain DNS information so we should respect that when
we configure the various XCI nodes. The DNS information is also a
list instead of a string so treat it as such.

Change-Id: I1c4d5eb600baaca35b2838dcafa7a75e59bf6783
Signed-off-by: Markos Chandras <mchandras@suse.de>
xci/infra/bifrost/playbooks/opnfv-virtual.yml
xci/playbooks/dynamic_inventory.py
xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2
xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2
xci/var/idf.yml

index 77f4b51..f97eae4 100644 (file)
         name: bifrost-configdrives-dynamic
         private: True
       vars:
-        ipv4_namesever: "{{ ipv4_nameserver | ((lookup('env','http_proxy') != '') | ternary('192.168.122.1', '8.8.8.8')) }}"
+        ipv4_nameserver: "{{ host_info[inventory_hostname]['public']['dns'] | list }}"
       delegate_to: opnfv
     - import_role:
         name: bifrost-deploy-nodes-dynamic
index 7f60f94..7831d19 100755 (executable)
@@ -47,7 +47,7 @@ class XCIInventory(object):
         self.opnfv_networks['opnfv']['public'] = {}
         self.opnfv_networks['opnfv']['public']['address'] = '192.168.122.2/24'
         self.opnfv_networks['opnfv']['public']['gateway'] = '192.168.122.1'
-        self.opnfv_networks['opnfv']['public']['dns'] = '192.168.122.1'
+        self.opnfv_networks['opnfv']['public']['dns'] = ['192.168.122.1']
         self.opnfv_networks['opnfv']['private'] = {}
         self.opnfv_networks['opnfv']['private']['address'] = '172.29.240.10/22'
         self.opnfv_networks['opnfv']['storage'] = {}
@@ -130,11 +130,13 @@ class XCIInventory(object):
             for network, ndata in idf['idf']['net_config'].items():
                 network_interface_num = idf['idf']['net_config'][network]['interface']
                 host_networks[hostname][network] = {}
+                host_networks[hostname][network]['dns'] = []
                 host_networks[hostname][network]['address'] = pdf_host_info['interfaces'][int(network_interface_num)]['address'] + "/" + str(ndata['mask'])
                 if 'gateway' in ndata.keys():
                     host_networks[hostname][network]['gateway'] = str(ndata['gateway']) + "/" + str(ndata['mask'])
                 if 'dns' in ndata.keys():
-                    host_networks[hostname][network]['dns'] = str(ndata['dns'])
+                    for d in ndata['dns']:
+                        host_networks[hostname][network]['dns'].append(str(d))
 
                 # Get also vlan and mac_address from pdf
                 host_networks[hostname][network]['mac_address'] = str(pdf_host_info['interfaces'][int(network_interface_num)]['mac_address'])
index 8e21b40..a8f1bf5 100644 (file)
@@ -73,7 +73,7 @@
 - name: Configure static DNS on SUSE
   lineinfile:
     regexp: '^NETCONFIG_DNS_STATIC_SERVERS=.*'
-    line: "NETCONFIG_DNS_STATIC_SERVERS={{ host_info[inventory_hostname]['public']['dns'] }}"
+    line: "NETCONFIG_DNS_STATIC_SERVERS=\"{{ host_info[inventory_hostname]['public']['dns'] | join(' ') }}\""
     path: "/etc/sysconfig/network/config"
     state: present
   when: host_info[inventory_hostname]['public']['dns'] is defined
index f9e4d8d..2f97600 100644 (file)
@@ -33,7 +33,7 @@ iface {{ item.name }} inet static
     gateway {{ item.network.gateway | ipaddr('address') }}
 {% endif %}
 {% if item.network is defined and item.network.dns is defined %}
-    dns-nameservers {{ item.network.dns }}
+    dns-nameservers {{ item.network.dns | join(' ') }}
 {% endif %}
 
 {% endif %}
index 3a51eb8..525686d 100644 (file)
@@ -21,6 +21,6 @@ IPADDR={{ item.network.address }}
 GATEWAY="{{ host_info[inventory_hostname]['public']['gateway'] | ipaddr('address') }}"
 {% endif %}
 {% if item.network is defined and item.network.dns is defined %}
-DNS="{{ host_info[inventory_hostname]['public']['dns'] }}"
+DNS="{{ host_info[inventory_hostname]['public']['dns'] | join(' ') }}"
 {% endif %}
 {% endif %}
index 7f20c3b..aa4edd9 100644 (file)
@@ -29,7 +29,8 @@ idf:
       network: 192.168.122.0
       mask: 24
       gateway: 192.168.122.1
-      dns: 192.168.122.1
+      dns:
+        - 192.168.122.1
     private:
       interface: 3
       network: 172.29.244.0