openstack.cloud.router should not remove existing interfaces
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ansible-collections-openstack |
New
|
Undecided
|
Unassigned |
Bug Description
If you specify a router but do not list any interfaces, and the router exists already, ansible should not remove the interfaces.
Example:
- name: "Configure edge router"
environment: "{{ admin_env }}"
delegate_to: localhost
connection: local
openstack.
name: "edge router"
state: "present"
project: admin
endpoint_type: internal
run_once: true
register: edge_router
tags: ['router']
This is kind of similar to https:/
Also, the module doesn't support check mode. This is easily fixed. This will also supply some useful information about changes in diff mode. (It seems that launchpad renders tabs incorrectly so the indentation seems wrong) (and editing to add that remark made it even more wrong, I hope the idea remains somewhat clear)
--- /usr/lib/ python3/ dist-packages/ ansible_ collections/ openstack/ cloud/plugins/ modules/ router. py 2024-03-09 10:59:30.000000000 +0000 cloud_router. py 2025-04-22 12:14:49.226717763 +0000
' external_ fixed_ips' : 'network',
' enable_ snat': 'network', check_mode= True,
+++ openstack_
@@ -338,6 +338,7 @@
},
+ supports_
)
@@ -635,6 +642,8 @@
if self.ansible. check_mode: internal_ ports = None
changed = True
changed = self._needs_update(
router, kwargs, external_fixed_ips, to_add, to_remove,
missing_ internal_ ports) json(changed= changed) json(changed= changed, kwargs=kwargs, to_add=to_add, to_remove= to_remove, router_ ifs_internal= router_ ifs_internal, external_ fixed_ips= external_ fixed_ips, missing_ internal_ ports=missing_ internal_ ports)
# Check if the system state would be changed
+ kwargs = None
+ missing_
if state == 'absent' and router:
elif state == 'absent' and not router:
@@ -647,7 +656,7 @@
- self.exit_
+ self.exit_
if state == 'present':
changed = False