Hi Uday,
The above commands work from the appliance login session when your prompt reads Command>
As soon as you type shell, you are dropped into an appliancesh session.
Usually denoted by a:
root@hostname [ ~ ]#
from the appliance shell you can get results for software packages by running:
python /usr/lib/applmgmt/support/scripts/software-packages.py
Followed by the same command structure; for example:
I have obscured part of the hostname.
Could you please clarify what you are attempting to do with ansible?