ios_command: How to get output of just stdout_lines or stdout in Ad-Hoc mode

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.

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.

OK. Thank You