Questions about Ansible NXOS command

Hello support team,

when I enter this command,

ansible test -m nxos_command

it gives me the following error:

10.122.234.253 | FAILED! => {
“changed”: false,
“failed”: true,
“msg”: “missing required arguments: username,host”
}

It seems lack of some parameters, however, there’s no more information about how to put the parameters in the command.
We want to excute “‘show version’” and “‘show running-config’” , can you help me, thanks!

You need to pass the required arguments to the module in order for it to run properly. Below is an example of running Ansible to collect the output from show running-config.

ansible -m nxos_command -a “host=nxos01 username=admin password=admin commands=‘show running-config’” localhost --connection local

An example playbook with output can be found here: https://gist.github.com/privateip/cd979aff53d7f4ba6fec854580e18a1d

Is this issue resolved? I am getting connection timed out error. Are there any extra configuration needed on nxos or ansible? I tested NX-API Developer Sandbox and able to receive response in json.

[lisa.huang@asvjmp01 ~]$ ansible -m nxos_command -a “host=10.2.253.100 username=admin password=password commands=‘show version’ transport=nxapi use_ssl=no” localhost --connection local
localhost | FAILED! => {
“changed”: false,
“failed”: true,
“msg”: “Connection failure: timed out”,
“status”: -1,
“url”: “http://10.2.253.100:80/ins
}

show feature | inc nxapi

nxapi 1 enabled

ansible --version

ansible 2.1.0.0

config file = /etc/ansible/ansible.cfg

configured module search path = Default w/o overrides