Shell module output from playboot is lesster than ansible adhoc shell output

16 views
Skip to first unread message

sun solaris

unread,
Apr 30, 2019, 1:10:45 AM4/30/19
to Ansible Project
Am facing this this weird issue.  Am getting less no of lines output for Shell module in playbook where getting full output in ansible adhoc for the same commands.

 Playbook output:

             "HOSTNAME - ansiblevm2",
            "DATE - Tue Apr 30 05:07:50 CUT 2019",
            "UPTIME -   05:07AM   up 7 days,  13:35,  1 user,  load average: 4.05, 4.66, 4.56",
            "OSLEVEL- 7200-03-01-1838",
            "",
            "",
            " Top 20 processes consuming memory",
            "USER          PID %CPU %MEM   SZ  RSS    TTY STAT    STIME  TIME COMMAND",
            "root      8978836  0.1  4.0 79484 76536      - A      Apr 22 46:41 /opt/BESClient",
            "root     13959600  0.0  1.0 25096 19180      - A      Apr 27  2:28 /opt/IBM/SCM/c",
            "root     11272508  0.0  1.0 10600 10612      - A    02:53:50  0:00 /opt/IBM/ITM/a",
            "root      9306390  0.1  1.0 32048 13364      - A      Apr 22 53:44 /opt/IBM/ITM/a",
            "root      4850110  0.0  1.0 13572 13616      - A      Apr 22  0:49 /opt/rsct/bin/",
            "root     16712108  0.0  0.0 1756  772      - A      Apr 22  0:05 /opt/IBM/ITM/a",
            "root     16318770  0.0  0.0 9500 2756      - A      Apr 22  0:21 /opt/IBM/ITM/a",
            "root     15729064  0.0  0.0 1592 1188      - A      Apr 22  0:00 /usr/sbin/sshd",
            "root     15204834  0.0  0.0 8536 8524      - A    02:53:19  0:00 /opt/IBM/ITM/a",
            "root     15073552  0.0  0.0 4544 1560      - A      Apr 22  0:12 /opt/IBM/ITM/a",
            "",
            "",
            " Top 20 processes consuming CPU",
            "USER          PID %CPU %MEM   SZ  RSS    TTY STAT    STIME  TIME COMMAND",
            "root      1048868  0.2  0.0  448  448      - A      Apr 22 74:40 wait",
            "root       983330  0.2  0.0  448  448      - A      Apr 22 74:43 wait",
            "root      9306390  0.1  1.0 32048 13364      - A      Apr 22 53:44 /opt/IBM/ITM/a",
            "root      8978836  0.1  4.0 79484 76536      - A      Apr 22 46:41 /opt/BESClient",
            "root       917792  0.1  0.0  448  448      - A      Apr 22 56:25 wait",
            "root          260  0.1  0.0  448  448      - A      Apr 22 33:44 wait",
            "root     16712108  0.0  0.0 1756  772      - A      Apr 22  0:05 /opt/IBM/ITM/a",
            "root     16318770  0.0  0.0 9500 2756      - A      Apr 22  0:21 /opt/IBM/ITM/a",
            "root     15729064  0.0  0.0 1592 1188      - A      Apr 22  0:00 /usr/sbin/sshd",
            "root     15204834  0.0  0.0 8536 8524      - A    02:53:19  0:00 /opt/IBM/ITM/a"
        ]
    }
}
=============================================================

Adhoc output.

172.18.2.24 | CHANGED | rc=0 >>
HOSTNAME - acmhost4test
DATE - Tue Apr 30 05:04:38 UTC 2019
UPTIME -  05:04:38 up 7 days, 16:57,  1 user,  load average: 0.00, 0.01, 0.05
OSLEVEL-


 Top 20 processes consuming memory
USER          PID %CPU %MEM   SZ  RSS    TTY STAT    STIME  TIME COMMAND
root     12976212  0.1  4.0 78520 76680      - A      Apr 22 56:57 /opt/BESClient
root     13762672  0.0  1.0 10544 10572      - A    03:10:50  0:00 /opt/IBM/ITM/a
root      9830434  0.0  1.0 25268 25264      - A      Apr 27  2:32 /opt/IBM/SCM/c
root      8847422  0.1  1.0 31000 15768      - A      Apr 22 52:42 /opt/IBM/ITM/a
root      6750234  0.0  1.0 13664 13968      - A      Apr 22  0:50 /opt/rsct/bin/
root     18677954  0.0  0.0 8420 8452      - A    03:10:19  0:00 /opt/IBM/ITM/a
root     18153568  0.0  0.0 1464 1228      - A    04:57:42  0:00 sshd: ibmadmin
root     16515312  0.0  0.0 8264 7596      - A    03:10:18  0:01 /opt/IBM/ITM/a
root     15794368  0.0  0.0  812  848  pts/0 A    04:57:51  0:00 -ksh
root     14811288  0.0  0.0 1476 1228      - A    05:04:39  0:00 sshd: cinstall
root     13828146  0.0  0.0 4440 1844      - A      Apr 22  0:12 /opt/IBM/ITM/a
root     11337798  0.0  0.0 9444 3352      - A      Apr 22  0:20 /opt/IBM/ITM/a
root     10551418  0.0  0.0 1760  836      - A      Apr 22  0:05 /opt/IBM/ITM/a
root     10289378  0.0  0.0 1680  880      - A      Apr 22  0:17 /opt/IBM/ITM/a
root     10092590  0.0  0.0 1964  960      - A      Apr 22  0:35 /opt/IBM/ITM/a
root      9961606  0.0  0.0 2600 2348      - A      Apr 22  0:03 /opt/itlm/tlma
root      9896184  0.0  0.0 12120 5532      - A      Apr 22  0:50 /opt/IBM/ITM/a
root      7602362  0.0  0.0  772  360      - A      Apr 22  0:00 /bin/ksh /opt/
root      7209208  0.0  0.0  780  816      - A    03:10:51  0:00 errpt -c -s043
root      7143556  0.0  0.0 2136  372      - A      Apr 22  0:00 /opt/rsct/bin/


 Top 20 processes consuming CPU
USER          PID %CPU %MEM   SZ  RSS    TTY STAT    STIME  TIME COMMAND
root      1179684  0.2  0.0  448  448      - A      Apr 22 77:44 wait
root      1114146  0.2  0.0  448  448      - A      Apr 22 77:45 wait
root     12976212  0.1  4.0 78520 76680      - A      Apr 22 56:57 /opt/BESClient
root      8847422  0.1  1.0 31000 15768      - A      Apr 22 52:42 /opt/IBM/ITM/a
root      1048608  0.1  0.0  448  448      - A      Apr 22 59:22 wait
root       131076  0.1  0.0  448  448      - A      Apr 22 35:04 wait
root     18677954  0.0  0.0 8420 8452      - A    03:10:19  0:00 /opt/IBM/ITM/a
root     18153568  0.0  0.0 1464 1228      - A    04:57:42  0:00 sshd: ibmadmin
root     16515312  0.0  0.0 8264 7596      - A    03:10:18  0:01 /opt/IBM/ITM/a
root     15794368  0.0  0.0  812  848  pts/0 A    04:57:51  0:00 -ksh
root     14811288  0.0  0.0 1476 1228      - A    05:04:39  0:00 sshd: cinstall
root     13828146  0.0  0.0 4440 1844      - A      Apr 22  0:12 /opt/IBM/ITM/a
root     13762672  0.0  1.0 10544 10572      - A    03:10:50  0:00 /opt/IBM/ITM/a
root     11337798  0.0  0.0 9444 3352      - A      Apr 22  0:20 /opt/IBM/ITM/a
root     10551418  0.0  0.0 1760  836      - A      Apr 22  0:05 /opt/IBM/ITM/a
root     10289378  0.0  0.0 1680  880      - A      Apr 22  0:17 /opt/IBM/ITM/a
root     10092590  0.0  0.0 1964  960      - A      Apr 22  0:35 /opt/IBM/ITM/a
root      9961606  0.0  0.0 2600 2348      - A      Apr 22  0:03 /opt/itlm/tlma
root      9896184  0.0  0.0 12120 5532      - A      Apr 22  0:50 /opt/IBM/ITM/a
root      9830434  0.0  1.0 25268 25264      - A      Apr 27  2:32 /opt/IBM/SCM/c

sun solaris

unread,
Apr 30, 2019, 1:17:00 AM4/30/19
to Ansible Project
Can anyone please help / advise ?

Thank you.

Matthew Davis

unread,
May 7, 2019, 8:34:54 PM5/7/19
to Ansible Project
I'm confused. What exactly is the problem? Those look the same to me.

Make sure you understand the difference between output.stdout and output.stdout_lines.

output.stdout is one string, including newline characters.
output.stdout_lines is a list of strings, one string per line.

Also, any stderr (which normally just appears in the terminal mixed in with the rest) will be saved to output.stderr (and output.stderr_lines).

We need more information about your problem before we can help more.

What does your task look like? (Copy and paste the yaml). What is the command you're running? Are you running it with sudo, or from a root shell, or normal shell? What is the difference between what you expect to see and what you actually see.

Regards,
Matt
Reply all
Reply to author
Forward
0 new messages