Closed round3d closed 3 months ago
The ospfv2 module doesn't properly render the distance.admin_distance section properly.
ios_ospfv2
ansible [core 2.15.8] config file = /home/taylorj/ansible/network/ansible.cfg configured module search path = ['/home/taylorj/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/taylorj/envs/ansible1/lib/python3.9/site-packages/ansible ansible collection location = /home/taylorj/.ansible/collections:/usr/share/ansible/collections executable location = /home/taylorj/envs/ansible1/bin/ansible python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/home/taylorj/envs/ansible1/bin/python3) jinja version = 3.1.2 libyaml = True
Collection Version ---------- ------- cisco.ios 6.1.1
CONFIG_FILE() = /home/taylorj/ansible/network/ansible.cfg DEFAULT_HOST_LIST(/home/taylorj/ansible/network/ansible.cfg) = ['/home/taylorj/ansible/network/hosts'] DEFAULT_VAULT_PASSWORD_FILE(/home/taylorj/ansible/network/ansible.cfg) = /home/taylorj/.ansible.pass HOST_KEY_CHECKING(/home/taylorj/ansible/network/ansible.cfg) = False
cisco 3650 Cisco IOS XE Software, Version 16.06.08
--- - name: setup interfaces hosts: all gather_facts: false connection: network_cli tasks: - cisco.ios.ios_ospfv2: config: processes: - process_id: 1 distance: admin_distance: distance: 1 state: rendered
The rendered ios config should include the distance like this
"rendered": [ "router ospf 1", "distance 1" ]
The config for the ospf process that is rendered doesn't include the admin distance.
ok: [c49300a] => { "changed": false, "invocation": { "module_args": { "config": { "processes": [ { "address_family": null, "adjacency": null, "areas": null, "auto_cost": null, "bfd": null, "capability": null, "compatible": null, "default_information": null, "default_metric": null, "discard_route": null, "distance": { "admin_distance": { "acl": null, "address": null, "distance": 1, "wildcard_bits": null }, "ospf": null }, "distribute_list": null, "domain_id": null, "domain_tag": null, "event_log": null, "help": null, "ignore": null, "interface_id": null, "ispf": null, "limit": null, "local_rib_criteria": null, "log_adjacency_changes": null, "max_lsa": null, "max_metric": null, "maximum_paths": null, "mpls": null, "neighbor": null, "network": null, "nsf": null, "passive_interface": null, "passive_interfaces": null, "prefix_suppression": null, "priority": null, "process_id": 1, "queue_depth": null, "router_id": null, "shutdown": null, "summary_address": null, "timers": null, "traffic_share": null, "ttl_security": null, "vrf": null } ] }, "running_config": null, "state": "rendered" } }, "rendered": [ "router ospf 1" ] }
The bug is in the ospfv2 distance.admin_distance template where the setval doesn't properly qualify the properties.
diff --git a/plugins/module_utils/network/ios/rm_templates/ospfv2.py b/plugins/module_utils/network/ios/rm_templates/ospfv2.py index 74b380c..8054825 100644 --- a/plugins/module_utils/network/ios/rm_templates/ospfv2.py +++ b/plugins/module_utils/network/ios/rm_templates/ospfv2.py @@ -721,9 +721,9 @@ class Ospfv2Template(NetworkTemplate): $""", re.VERBOSE, ), - "setval": "distance {{ admin_distance.distance }} " - "{{ ( admin_distance.address + ' ' + admin_distance.wildcard_bits ) if admin_distance.address is defined else '' }}" - "{{ ' ' + admin_distance.acl if admin_distance.acl is defined else '' }}", + "setval": "distance {{ distance.admin_distance.distance }} " + "{{ ( distance.admin_distance.address + ' ' + distance.admin_distance.wildcard_bits ) if distance.admin_distance.address is defined else '' }}" + "{{ ' ' + distance.admin_distance.acl if distance.admin_distance.acl is defined else '' }}", "result": { "processes": { "{{ pid }}": {
SUMMARY
The ospfv2 module doesn't properly render the distance.admin_distance section properly.
ISSUE TYPE
COMPONENT NAME
ios_ospfv2
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
cisco 3650 Cisco IOS XE Software, Version 16.06.08
STEPS TO REPRODUCE
EXPECTED RESULTS
The rendered ios config should include the distance like this
ACTUAL RESULTS
The config for the ospf process that is rendered doesn't include the admin distance.
The bug is in the ospfv2 distance.admin_distance template where the setval doesn't properly qualify the properties.