Skip to content

Commit

Permalink
[ignore] Add option to delete loopback interface profile in aci_l3out…
Browse files Browse the repository at this point in the history
…_logical_node.
  • Loading branch information
gmicol committed Sep 14, 2023
1 parent 4c75301 commit d448b52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 12 additions & 3 deletions plugins/modules/aci_l3out_logical_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@
loopback_address:
description:
- Loopback IP.
- to delete the existing loopback IP, pass an empty string.
type: str
delete_loopback_address:
description:
- Option to delete the current loopback interface profile.
- the current loopback address needs to be provided in order to be deleted.
type: str
choices: [ 'yes', 'no' ]
default: 'no'
state:
description:
- Use C(present) or C(absent) for adding or removing.
Expand Down Expand Up @@ -248,6 +255,7 @@ def main():
router_id=dict(type="str"),
router_id_as_loopback=dict(type="str", default="yes", choices=["yes", "no"]),
loopback_address=dict(type="str"),
delete_loopback_address=dict(type="str", default="no", choices=["yes", "no"]),
state=dict(type="str", default="present", choices=["absent", "present", "query"]),
)

Expand All @@ -268,6 +276,7 @@ def main():
router_id = module.params.get("router_id")
router_id_as_loopback = module.params.get("router_id_as_loopback")
loopback_address = module.params.get("loopback_address")
delete_loopback_address = module.params.get("delete_loopback_address")
state = module.params.get("state")

tdn = None
Expand All @@ -281,8 +290,8 @@ def main():
child_configs = []

if loopback_address is not None:
if loopback_address == "":
child_configs.extend([dict(l3extLoopBackIfP=dict(attributes=dict(addr="", status="deleted")))])
if delete_loopback_address == "yes":
child_configs.extend([dict(l3extLoopBackIfP=dict(attributes=dict(addr=loopback_address, status="deleted")))])
else:
child_configs.extend([dict(l3extLoopBackIfP=dict(attributes=dict(addr=loopback_address)))])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
- name: Remove loopback address
aci_l3out_logical_node: &node_remove_loopback
<<: *node_add_loopback
loopback_address: ''
loopback_address: 11.11.11.12
delete_loopback_address: "yes"
register: remove_loopback_ip

- name: Verify update_node
Expand Down

0 comments on commit d448b52

Please sign in to comment.