Running ansible 2.10.17
I keep getting % Invalid input detected at '^' marker. when trying to run a role.
here is my code. Note "filter", "trust", and "untrust" are passed in with -e as extra variables.
-- name: Include vars
include_vars:
file: ../../../settings.yaml
name: settings
- name: Extract tags from trust + untrust variables
set_fact:
trust_tag_filter: "{ {{ trust }}.split(':')[0] }"
untrust_tag_filter: "{ {{ untrust }}.split(':')[0] }"
- name: Routers configuration, filter "{{ filter }}", with trust tag filter "{{ trust_tag_filter }}", and untrust tag filter "{{ untrust_tag_filter }}"
iosxr_command:
commands:
- show run formal object-group network ipv4 | u egrep {{ filter }}
- show run ipv4 access-list acl_trust_in | u egrep {{ filter }}
- show run formal interface | u egrep "BVI{{ trust_tag_filter }}"
- show run formal interface | u egrep "BVI{{ untrust_tag_filter }}"
- show run formal interface | u egrep "Bundle-Ether21.{{ trust_tag_filter }}"
- show run formal interface | u egrep "Bundle-Ether21.{{ untrust_tag_filter }}"
- show run formal interface | u egrep "Bundle-Ether22.{{ trust_tag_filter }}"
- show run formal interface | u egrep "Bundle-Ether22.{{ untrust_tag_filter }}"
- show run formal interface | u egrep "Bundle-Ether23.{{ trust_tag_filter }}"
- show run formal interface | u egrep "Bundle-Ether23.{{ untrust_tag_filter }}"
- show run formal interface | u egrep "Bundle-Ether24.{{ trust_tag_filter }}"
- show run formal interface | u egrep "Bundle-Ether24.{{ untrust_tag_filter }}"
- show run l2vpn bridge group TRUST bridge-domain "VLAN{{ trust_tag_filter }}"
- show run l2vpn bridge group UNTRUST bridge-domain "VLAN{{ untrust_tag_filter }}"
- show run router static address-family ipv4 unicast | utility egrep 'router\ static|family|{{settings.lan_subnet_prefix}}{{filter}}|10.30.{{filter}}'
- show evpn evi | u egrep 'VPN-ID|{{ trust_tag_filter }}|{{ untrust_tag_filter }}'
register: response
- debug: msg="{{ response.stdout }}"
But when I run it I keep getting this error
The full traceback is:
File "/tmp/ansible_iosxr_command_payload_kxd7v36e/ansible_iosxr_command_payload.zip/ansible_collections/cisco/iosxr/plugins/module_utils/network/iosxr/iosxr.py", line 586, in run_commands
return connection.run_commands(commands=commands, check_rc=check_rc)
File "/tmp/ansible_iosxr_command_payload_kxd7v36e/ansible_iosxr_command_payload.zip/ansible/module_utils/connection.py", line 200, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [router.our.domain]: FAILED! => changed=false
invocation:
module_args:
commands:
- show run formal object-group network ipv4 | u egrep 89
- show run ipv4 access-list acl_trust_in | u egrep 89
- show run formal interface | u egrep "BVI{ 1234:192.168.20.0/29.split(':')[0] }"
- show run formal interface | u egrep "BVI{ 1235:192.168.30.0/29.split(':')[0] }"
- show run formal interface | u egrep "Bundle-Ether21.{ 1234:192.168.20.0/29.split(':')[0] }"
- show run formal interface | u egrep "Bundle-Ether21.{ 1235:192.168.30.0/29.split(':')[0] }"
- show run formal interface | u egrep "Bundle-Ether22.{ 1234:192.168.20.0/29.split(':')[0] }"
- show run formal interface | u egrep "Bundle-Ether22.{ 1235:192.168.30.0/29.split(':')[0] }"
- show run formal interface | u egrep "Bundle-Ether23.{ 1234:192.168.20.0/29.split(':')[0] }"
- show run formal interface | u egrep "Bundle-Ether23.{ 1235:192.168.30.0/29.split(':')[0] }"
- show run formal interface | u egrep "Bundle-Ether24.{ 1234:192.168.20.0/29.split(':')[0] }"
- show run formal interface | u egrep "Bundle-Ether24.{ 1235:192.168.30.0/29.split(':')[0] }"
- show run l2vpn bridge group TRUST bridge-domain "VLAN{ 1234:192.168.20.0/29.split(':')[0] }"
- show run l2vpn bridge group UNTRUST bridge-domain "VLAN{ 1235:192.168.30.0/29.split(':')[0] }"
- show run router static address-family ipv4 unicast | utility egrep 'router\ static|family|10.35.89|10.30.89'
- show evpn evi | u egrep 'VPN-ID|{ 1234:192.168.20.0/29.split(':')[0] }|{ 1235:192.168.30.0/29.split(':')[0] }'
interval: 1
match: all
provider: null
retries: 10
wait_for: null
msg: |-
show run formal interface | u egrep "BVI{ 1234:192.168.20.0/29.split(':')[0] }"
^
% Invalid input detected at '^' marker.
RP/0/RP0/CPU0:router#
Why? Am I not defining the variables correctly?
show run formal interface ...... Feed that to a debug task get the output and play it manually on your device to see if you get the same error. If the debug output is not what is expected then show exactly what it is supposed to look like.