# ios\_command: How to get output of just stdout\_lines or stdout in Ad-Hoc mode

**URL:** <https://forum.ansible.com/t/ios-command-how-to-get-output-of-just-stdout-lines-or-stdout-in-ad-hoc-mode/28023>\
**Category:** Ansible Project\
**Created:** [July 11, 2018, 3:28am UTC](https://forum.ansible.com/t/ios-command-how-to-get-output-of-just-stdout-lines-or-stdout-in-ad-hoc-mode/28023 "2018-07-11T03:28:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dilraj\_Singh\_Khalsa](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@Dilraj\_Singh\_Khalsa](https://forum.ansible.com/u/Dilraj_Singh_Khalsa)\
**Post date:** [July 11, 2018, 3:28am UTC](https://forum.ansible.com/t/ios-command-how-to-get-output-of-just-stdout-lines-or-stdout-in-ad-hoc-mode/28023/1 "2018-07-11T03:28:36Z")

</div>

Hi,

Is there a way to get the result of just “stdout\_lines” or “stdout” in the output. Below is the command I am using:

_ansible S1 -m exos\_command -a “commands=‘show version’”_

Now the output includes both stdout and stdout\_lines which is more than what I need for the sake of this do. Below is the sample:

_S1 | SUCCESS =\> {_

_“changed”: false,_

_“stdout”: [_

_“Switch : PN:1N2039 SN:123456 Rev 01 BootROM: 1.2 IMG: 22.5.1.7 \nPSUCTRL-1 : PN:MEAD SN:MD1 Rev 01 BootROM: 2.1 \nPSUCTRL-2 : PN:MEAD SN:MD2 Rev 11 BootROM: 2.3 \nmouse-usb : PN:MOUSE SN:4321 Rev 11 BootROM: 4.3 \nfloppy-A :\nPSU-1 : Internal PSU-2 PN:1N2039 SN:12345\nPSU-2 : Internal PSU-3 PN:1N2039 SN:12345\n\nImage : ExtremeXOS version 22.5.1.7 by release-manager\n on Tue May 22 11:01:38 EDT 2018\nBootROM : 1.2\nCertified Version : EXOS Linux 3.18.48, FIPS fips-ecp-2.0.16”_

_],_

_“stdout\_lines”: [_

_[_

_"Switch : PN:1N2039 SN:123456 Rev 01 BootROM: 1.2 IMG: 22.5.1.7 ",_

_"PSUCTRL-1 : PN:MEAD SN:MD1 Rev 01 BootROM: 2.1 ",_

_"PSUCTRL-2 : PN:MEAD SN:MD2 Rev 11 BootROM: 2.3 ",_

_"mouse-usb : PN:MOUSE SN:4321 Rev 11 BootROM: 4.3 ",_

_“floppy-A :”,_

_“PSU-1 : Internal PSU-2 PN:1N2039 SN:12345”,_

_“PSU-2 : Internal PSU-3 PN:1N2039 SN:12345”,_

_“”,_

_“Image : ExtremeXOS version 22.5.1.7 by release-manager”,_

_" on Tue May 22 11:01:38 EDT 2018",_

_“BootROM : 1.2”,_

_“Certified Version : EXOS Linux 3.18.48, FIPS fips-ecp-2.0.16”_

_]_

_]_

_}_

NOTE: I am using this as an ad-hoc command. I know how we can filter this in a playbook but not sure how to do in ad-hoc mode.

Any suggestion on this would be appreciated.

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 11, 2018, 9:54am UTC](https://forum.ansible.com/t/ios-command-how-to-get-output-of-just-stdout-lines-or-stdout-in-ad-hoc-mode/28023/2 "2018-07-11T09:54:05Z")

</div>

Not out of the box, ansible adhoc only run one task at a time.

But you can write you own callback plugin that format the output in the way you like.

---

<div class="post-metadata">

**Author:** ![Dilraj\_Singh\_Khalsa](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@Dilraj\_Singh\_Khalsa](https://forum.ansible.com/u/Dilraj_Singh_Khalsa)\
**Post date:** [July 11, 2018, 11:45am UTC](https://forum.ansible.com/t/ios-command-how-to-get-output-of-just-stdout-lines-or-stdout-in-ad-hoc-mode/28023/3 "2018-07-11T11:45:09Z")

</div>

OK. Thank You
