Closed nspitzer closed 2 years ago
Hey, @nspitzer I tried reproducing it on my end I faced some other issues with the play you shared.
Recommendations would be you should be able to use the gathered
state to build the source of truth in the context of reusing it within another task, it would save you dealing with command modules in this use case, and the last task you must feed structured data to config
rather than running_config
. Please consider checking the issues with he change suggested.
But, as per the reported issue, the task with the parsed state gives no exception at my end.
Regards
and, can you please share the jinja2 version you are using?
@nspitzer Closing this issue as there is no activity here
Dear @KB-perByte, Although @nspitzer has not replied to you, I actually have the same issue. The Playbook I am trying to run is as follows:
name: Route Map TO_TRANSIT_CLOUD_GENERAL Configuration hosts: cloudrouters gather_facts: false
tasks:
After running the playbook and debugging, I got the following output:
fatal: [test]: FAILED! => { "changed": false, "invocation": { "module_args": { "config": [ { "entries": [ { "action": "deny", "continue_entry": null, "description": "Deny the default route to the CSPs", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "DEFAULT-ROUTE" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 10, "set": null }, { "action": "permit", "continue_entry": null, "description": "Match NAM Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "NAM_SUMMARY_ROUTES", "USA-Colocation-Subnets" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 20, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 1, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match SAM Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "SAM_SUMMARY_ROUTES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 21, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 1, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match ASA Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "ASA_SUMMARY_ROUTES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 30, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 234, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match EAF Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "EAF_SUMMARY_ROUTES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 31, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 234, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match MEA Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "MEA_SUMMARY_ROUTES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 32, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 234, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match Anycast and General Summaries and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "GLOBAL_SUMMARY_ROUTES", "ANYCAST-DNS-SUMMARIES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 50, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 1, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "deny", "continue_entry": null, "description": "Deny any non-previous matching traffic", "match": null, "sequence": 100, "set": null } ], "route_map": "TO_TRANSIT_CLOUD_GENERAL" } ], "running_config": null, "state": "replaced" } }, "msg": "'route_map' is undefined" }
I am running Ansible version 6.0 and the cisco.ios version is 3.2.0
ansible [core 2.13.1] config file = /etc/ansible/ansible.cfg configured module search path = ['/home/gbloise/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/gbloise/.local/lib/python3.8/site-packages/ansible ansible collection location = /home/gbloise/.ansible/collections executable location = /home/gbloise/.local/bin/ansible python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] jinja version = 3.1.2 libyaml = True
Collection Version
cisco.ios 3.0.0
Collection Version
cisco.ios 3.2.0
Dear @KB-perByte, Although @nspitzer has not replied to you, I actually have the same issue. The Playbook I am trying to run is as follows:
name: Route Map TO_TRANSIT_CLOUD_GENERAL Configuration hosts: cloudrouters gather_facts: false
tasks:
- name: TO_TRANSIT_CLOUD_GENERAL Configuration when: inventory_hostname == "test" cisco.ios.ios_route_maps: config:
- route_map: TO_TRANSIT_CLOUD_GENERAL entries:
- sequence: 10 action: deny description: Deny the default route to the CSPs match: ip: address: prefix_lists:
- DEFAULT-ROUTE
- sequence: 20 action: permit description: Match NAM Summary routes and set AS_PATH x 1 match: ip: address: prefix_lists:
- NAM_SUMMARY_ROUTES
- USA-Colocation-Subnets set: metric: metric_value: 1 as_path: prepend: last_as: 1
- sequence: 21 action: permit description: Match SAM Summary routes and set AS_PATH x 1 match: ip: address: prefix_lists:
- SAM_SUMMARY_ROUTES set: metric: metric_value: 1 as_path: prepend: last_as: 1
- sequence: 30 action: permit description: Match ASA Summary routes and set AS_PATH x 1 match: ip: address: prefix_lists:
- ASA_SUMMARY_ROUTES set: metric: metric_value: 234 as_path: prepend: last_as: 1
- sequence: 31 action: permit description: Match EAF Summary routes and set AS_PATH x 1 match: ip: address: prefix_lists:
- EAF_SUMMARY_ROUTES set: metric: metric_value: 234 as_path: prepend: last_as: 1
- sequence: 32 action: permit description: Match MEA Summary routes and set AS_PATH x 1 match: ip: address: prefix_lists:
- MEA_SUMMARY_ROUTES set: metric: metric_value: 234 as_path: prepend: last_as: 1
- sequence: 50 action: permit description: Match Anycast and General Summaries and set AS_PATH x 1 match: ip: address: prefix_lists:
- GLOBAL_SUMMARY_ROUTES
- ANYCAST-DNS-SUMMARIES set: metric: metric_value: 1 as_path: prepend: last_as: 1
- sequence: 100 action: deny description: Deny any non-previous matching traffic state: replaced
After running the playbook and debugging, I got the following output:
fatal: [test]: FAILED! => { "changed": false, "invocation": { "module_args": { "config": [ { "entries": [ { "action": "deny", "continue_entry": null, "description": "Deny the default route to the CSPs", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "DEFAULT-ROUTE" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 10, "set": null }, { "action": "permit", "continue_entry": null, "description": "Match NAM Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "NAM_SUMMARY_ROUTES", "USA-Colocation-Subnets" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 20, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 1, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match SAM Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "SAM_SUMMARY_ROUTES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 21, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 1, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match ASA Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "ASA_SUMMARY_ROUTES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 30, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 234, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match EAF Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "EAF_SUMMARY_ROUTES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 31, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 234, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match MEA Summary routes and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "MEA_SUMMARY_ROUTES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 32, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 234, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "permit", "continue_entry": null, "description": "Match Anycast and General Summaries and set AS_PATH x 1", "match": { "additional_paths": null, "as_path": null, "clns": null, "community": null, "extcommunity": null, "interfaces": null, "ip": { "address": { "acls": null, "prefix_lists": [ "GLOBAL_SUMMARY_ROUTES", "ANYCAST-DNS-SUMMARIES" ] }, "flowspec": null, "next_hop": null, "redistribution_source": null, "route_source": null }, "ipv6": null, "length": null, "local_preference": null, "mdt_group": null, "metric": null, "mpls_label": null, "policy_lists": null, "route_type": null, "rpki": null, "security_group": null, "source_protocol": null, "tag": null, "track": null }, "sequence": 50, "set": { "aigp_metric": null, "as_path": { "prepend": { "as_number": null, "last_as": 1 }, "tag": null }, "automatic_tag": null, "clns": null, "comm_list": null, "community": null, "dampening": null, "default": null, "extcomm_list": null, "extcommunity": null, "global_route": null, "interfaces": null, "ip": null, "ipv6": null, "level": null, "lisp": null, "local_preference": null, "metric": { "deviation": null, "eigrp_delay": null, "metric_bandwidth": null, "metric_reliability": null, "metric_value": 1, "mtu": null }, "metric_type": null, "mpls_label": null, "origin": null, "tag": null, "traffic_index": null, "vrf": null, "weight": null } }, { "action": "deny", "continue_entry": null, "description": "Deny any non-previous matching traffic", "match": null, "sequence": 100, "set": null } ], "route_map": "TO_TRANSIT_CLOUD_GENERAL" } ], "running_config": null, "state": "replaced" } }, "msg": "'route_map' is undefined" }
I am running Ansible version 6.0 and the cisco.ios version is 3.2.0
ansible [core 2.13.1] config file = /etc/ansible/ansible.cfg configured module search path = ['/home/gbloise/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /home/gbloise/.local/lib/python3.8/site-packages/ansible ansible collection location = /home/gbloise/.ansible/collections executable location = /home/gbloise/.local/bin/ansible python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] jinja version = 3.1.2 libyaml = True
/home/gbloise/.local/lib/python3.8/site-packages/ansible_collections
Collection Version
cisco.ios 3.0.0
/home/gbloise/.ansible/collections/ansible_collections
Collection Version
cisco.ios 3.2.0
Hey @netexgb thanks for the details I'll look into it would you please raise a separate issue with the details you shared. Thank you.
Hi @KB-perByte, Thanks for your reply. I opened a new case, its number is #618 .. Please let me know if anything else is required :) Regards, Gian
SUMMARY
valid route maps generating "'route_map' is undefined error" in cisco.ios.ios_route_maps parser . Additionally testing showed valid YAML to create route map generating identical error in renderer.
Desired route map config was:
route-map BGP_TO_EC permit 10 \n match ip address prefix-list DEFAULT !
ISSUE TYPE
COMPONENT NAME
cisco.ios.ios.route_maps
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
nspitzer@ansibletest:/home/share/ansible$ ansible-config dump --only-changed DEFAULT_HOST_LIST(/home/nspitzer/.ansible.cfg) = ['/home/share/ansible/hosts'] DEFAULT_MODULE_PATH(/home/nspitzer/.ansible.cfg) = ['/home/nspitzer/.ansible/collections/ansible_collections']
STEPS TO REPRODUCE
EXPECTED RESULTS
The following YAML should be displayed: `cisco.ios.ios_route_maps: config:
ACTUAL RESULTS
Error is generated: "msg": "'route_map' is undefined" in parser task. Note same error occurs feeding valid YAML to render