mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Update the nova inventory plugin with new ip code
The provisioning module knows more about how nova deals with IP addresses now. Ensure that the inventory module is similarly as smart by separating out the logic into the openstack/module_utils.
This commit is contained in:
parent
a12086f1bf
commit
a05804bf8d
3 changed files with 35 additions and 33 deletions
|
@ -54,3 +54,16 @@ def openstack_argument_spec():
|
|||
else:
|
||||
spec['login_tenant_name'] = dict(required=True)
|
||||
return spec
|
||||
|
||||
|
||||
def openstack_find_nova_addresses(addresses, ext_tag, key_name=None):
|
||||
|
||||
ret = []
|
||||
for (k, v) in addresses.iteritems():
|
||||
if key_name and k == key_name:
|
||||
ret.extend([addrs['addr'] for addrs in v])
|
||||
else:
|
||||
for interface_spec in v:
|
||||
if 'OS-EXT-IPS:type' in interface_spec and interface_spec['OS-EXT-IPS:type'] == ext_tag:
|
||||
ret.append(interface_spec['addr'])
|
||||
return ret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue