From: Markos Chandras Date: Fri, 18 May 2018 07:36:11 +0000 (+0000) Subject: Merge "xci: kubespray: Switch kubespray to dynamic inventory" X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=8de89f399e18ea3b29f5f19b7319a11d45fedbe0;p=releng-xci.git Merge "xci: kubespray: Switch kubespray to dynamic inventory" --- 8de89f399e18ea3b29f5f19b7319a11d45fedbe0 diff --cc xci/playbooks/dynamic_inventory.py index 552a1337,535dc259..6d9d217f --- a/xci/playbooks/dynamic_inventory.py +++ b/xci/playbooks/dynamic_inventory.py @@@ -98,14 -96,12 +101,15 @@@ class XCIInventory(object) pdf_host_info = filter(lambda x: x['name'] == host, pdf['nodes'])[0] native_vlan_if = filter(lambda x: x['vlan'] == 'native', pdf_host_info['interfaces']) self.add_hostvar(hostname, 'ansible_host', native_vlan_if[0]['address']) + self.add_hostvar(hostname, 'ip', native_vlan_if[0]['address']) host_networks[hostname] = {} # And now record the rest of the information - for network in idf['idf']['net_config'].keys(): + for network, ndata in idf['idf']['net_config'].items(): network_interface_num = idf['idf']['net_config'][network]['interface'] - host_networks[hostname][network] = pdf_host_info['interfaces'][int(network_interface_num)]['address'] + host_networks[hostname][network] = {} + 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']) host_networks.update(self.opnfv_networks)