failed while connecting to remote hosts

able to connect few hosts but not all, i get the following error

hostnamexxx | FAILED >> {“failed”: true, “msg”: “\r\nSorry, user user123 is not allowed to execute ‘/bin/sh -c echo BECOME-SUCCESS-ulmhjizflgyappzkndibaykuvymkwnds; LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python /tmp/ansible-tmp-1451954748.36-250854743528657/command’ as appuser on .\r\n”, “parsed”: false}

command used to connect to remote hosts :

$ansible testuat -i dev -u user123 -ks -U appuser -K -m command -a “uptime” -o

SSH password:

SUDO password[defaults to SSH password]:

testuat is the inventory file

my requirement

ssh to—> user123@bastian host ---->ssh user123@acutal host —> sudo su - appuser

Thanks in Advance

Per that error, user123 is not permitted to execute /bin/sh as appuser via sudo:

Sorry, user user123 is not allowed to execute ‘/bin/sh…’ as appuser on <hostnamexxxxx