Hi,
when I use regex_search in my playbook, then I get this error message:
task [Output to file] **********************************************************
#fatal: [R34-N5696Q-1]: FAILED! => {“msg”: “Unexpected templating type error occurred on ({{ out.std
#regex_search(‘100’) #}}): expected string or buffer”}…ignoring
-
name: “Read Sub-Config”
nxos_command:
provider:
timeout: 20
commands: -
“{{ c }}{{ subName }}”
register: out -
name: “Output to file”
no_log: false
vars:
outsql: “{{ out | b64encode }}”
cCmdsql: “{{ c }}{{ subName }}”
sqlRecord: “{{ s }}-{{ subName | regex_replace(‘interface ‘,’’,ignorecase=True) }},{{ s }},”
sqlVLAN: “{{ out.stdout | regex_search(‘100’) }}”
lineinfile:
path: ‘{{ p }}’
line: ‘{{sqlRecord}}{{ sqlVLAN }}’
create: no
ignore_errors: true
When change "regex_search(‘100’) to regex_replace(‘100’,‘9999’), that works fine.
sqlVLAN: “{{ out.stdout | regex_search(‘100’) }}”
(‘100’ ist a excample, late I will search a number with ‘\d+’)
What is my problem? Can you help me?
Klemens