summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkos Chandras <mchandras@suse.de>2018-11-07 16:31:08 +0000
committerMarkos Chandras <mchandras@suse.de>2018-11-08 09:23:57 +0000
commitc53017fa23a3e495f8a091dd7e6be902fc966137 (patch)
treec4e5c191640e4602f09320441846a39eb426960a
parent5810ddcaac4a7405d683216f877fc0deafefb0f1 (diff)
xci: bifrost: Respect IDF DNS details during node configuration
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>
-rw-r--r--xci/infra/bifrost/playbooks/opnfv-virtual.yml2
-rwxr-xr-xxci/playbooks/dynamic_inventory.py6
-rw-r--r--xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml2
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j22
-rw-r--r--xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j22
-rw-r--r--xci/var/idf.yml3
6 files changed, 10 insertions, 7 deletions
diff --git a/xci/infra/bifrost/playbooks/opnfv-virtual.yml b/xci/infra/bifrost/playbooks/opnfv-virtual.yml
index 77f4b512..f97eae4b 100644
--- a/xci/infra/bifrost/playbooks/opnfv-virtual.yml
+++ b/xci/infra/bifrost/playbooks/opnfv-virtual.yml
@@ -141,7 +141,7 @@
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
diff --git a/xci/playbooks/dynamic_inventory.py b/xci/playbooks/dynamic_inventory.py
index 7f60f94e..7831d197 100755
--- a/xci/playbooks/dynamic_inventory.py
+++ b/xci/playbooks/dynamic_inventory.py
@@ -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'])
diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
index 8e21b40d..a8f1bf59 100644
--- a/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
+++ b/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml
@@ -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
diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2
index f9e4d8df..2f976002 100644
--- a/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2
@@ -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 %}
diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2
index 3a51eb86..525686d9 100644
--- a/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2
+++ b/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2
@@ -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 %}
diff --git a/xci/var/idf.yml b/xci/var/idf.yml
index 7f20c3bf..aa4edd93 100644
--- a/xci/var/idf.yml
+++ b/xci/var/idf.yml
@@ -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