mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-03-26 21:43:02 +00:00
Merge "Fix router module external IPs when only subnet specified"
This commit is contained in:
@@ -558,6 +558,46 @@
|
|||||||
assert:
|
assert:
|
||||||
that: router is not changed
|
that: router is not changed
|
||||||
|
|
||||||
|
- name: Create router without explicit IP address
|
||||||
|
openstack.cloud.router:
|
||||||
|
cloud: "{{ cloud }}"
|
||||||
|
state: present
|
||||||
|
name: "{{ router_name }}"
|
||||||
|
enable_snat: false
|
||||||
|
interfaces:
|
||||||
|
- shade_subnet1
|
||||||
|
network: "{{ external_network_name }}"
|
||||||
|
external_fixed_ips:
|
||||||
|
- subnet_id: shade_subnet5
|
||||||
|
register: router
|
||||||
|
|
||||||
|
- name: Assert idempotent module
|
||||||
|
assert:
|
||||||
|
that: router is changed
|
||||||
|
|
||||||
|
- name: Update router without explicit IP address
|
||||||
|
openstack.cloud.router:
|
||||||
|
cloud: "{{ cloud }}"
|
||||||
|
state: present
|
||||||
|
name: "{{ router_name }}"
|
||||||
|
enable_snat: false
|
||||||
|
interfaces:
|
||||||
|
- shade_subnet1
|
||||||
|
network: "{{ external_network_name }}"
|
||||||
|
external_fixed_ips:
|
||||||
|
- subnet_id: shade_subnet5
|
||||||
|
register: router
|
||||||
|
|
||||||
|
- name: Assert idempotent module
|
||||||
|
assert:
|
||||||
|
that: router is not changed
|
||||||
|
|
||||||
|
- name: Delete router
|
||||||
|
openstack.cloud.router:
|
||||||
|
cloud: "{{ cloud }}"
|
||||||
|
state: absent
|
||||||
|
name: "{{ router_name }}"
|
||||||
|
|
||||||
- name: Create router with simple interface
|
- name: Create router with simple interface
|
||||||
openstack.cloud.router:
|
openstack.cloud.router:
|
||||||
cloud: "{{ cloud }}"
|
cloud: "{{ cloud }}"
|
||||||
|
|||||||
@@ -372,6 +372,10 @@ class RouterModule(OpenStackModule):
|
|||||||
for p in external_fixed_ips:
|
for p in external_fixed_ips:
|
||||||
if 'ip_address' in p:
|
if 'ip_address' in p:
|
||||||
req_fip_map[p['subnet_id']].add(p['ip_address'])
|
req_fip_map[p['subnet_id']].add(p['ip_address'])
|
||||||
|
elif p['subnet_id'] in cur_fip_map:
|
||||||
|
# handle idempotence of updating with no explicit ip
|
||||||
|
req_fip_map[p['subnet_id']].update(
|
||||||
|
cur_fip_map[p['subnet_id']])
|
||||||
|
|
||||||
# Check if external ip addresses need to be added
|
# Check if external ip addresses need to be added
|
||||||
for fip in external_fixed_ips:
|
for fip in external_fixed_ips:
|
||||||
@@ -464,7 +468,7 @@ class RouterModule(OpenStackModule):
|
|||||||
subnet = self.conn.network.find_subnet(
|
subnet = self.conn.network.find_subnet(
|
||||||
iface['subnet_id'], ignore_missing=False, **filters)
|
iface['subnet_id'], ignore_missing=False, **filters)
|
||||||
fip = dict(subnet_id=subnet.id)
|
fip = dict(subnet_id=subnet.id)
|
||||||
if 'ip_address' in iface:
|
if iface.get('ip_address', None) is not None:
|
||||||
fip['ip_address'] = iface['ip_address']
|
fip['ip_address'] = iface['ip_address']
|
||||||
external_fixed_ips.append(fip)
|
external_fixed_ips.append(fip)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user