Merge "xci: kubespray: Switch kubespray to dynamic inventory"
authorMarkos Chandras <mchandras@suse.de>
Fri, 18 May 2018 07:36:11 +0000 (07:36 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Fri, 18 May 2018 07:36:11 +0000 (07:36 +0000)
1  2 
xci/installer/kubespray/playbooks/configure-opnfvhost.yml
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)