Hey Folks,
Trying to get sh int des | i by ansible.
my ansible play is adding the special character which didn’t work on the switch.
debug: sample output
“commands”: [
“sh int des |i "host161|host162"”
I would like to remove the special character """ in the playbook itself. is there a way to do ?
play:
rgs.txt contains two lines hostname
host161
host162
vars:
result: “{{ lookup(‘file’, ‘rgs.txt’) | regex_replace(‘[\r\n\t]+’,‘|’) }}”
- name: Run network commands
ios_command:
commands: sh int des |i “{{ result }}”
Thanks,
Ramesh