# ios\_command by ansible

**URL:** <https://forum.ansible.com/t/ios-command-by-ansible/36618>\
**Category:** Ansible Project\
**Created:** [May 11, 2022, 9:08pm UTC](https://forum.ansible.com/t/ios-command-by-ansible/36618 "2022-05-11T21:08:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramesh\_AR](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@Ramesh\_AR](https://forum.ansible.com/u/Ramesh_AR)\
**Post date:** [May 11, 2022, 9:08pm UTC](https://forum.ansible.com/t/ios-command-by-ansible/36618/1 "2022-05-11T21:08:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![KB-perByte](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kb-perbyte/32/541_2.png) [@KB-perByte](https://forum.ansible.com/u/KB-perByte)\
**Post date:** [May 24, 2022, 6:51am UTC](https://forum.ansible.com/t/ios-command-by-ansible/36618/2 "2022-05-24T06:51:21Z")

</div>

Hey Ramesh,  
This is a known issue for the ios\_command module, the way the command and responses are formatted causes the issue you are facing, The solution to this is a bit tricky we are looking forward to fixing it.  
You may draft a GitHub issue [here](https://github.com/ansible-collections/cisco.ios/issues) to keep track of this issue.

Regards,  
Sagar Paul  
_E - [sagpaul@redhat.com](mailto:sagpaul@redhat.com)_  
_G - KB-perByte_
