CiscoDevNet / ansible-nd

Cisco ND Ansible Collection
https://galaxy.ansible.com/cisco/nd
GNU General Public License v3.0
4 stars 15 forks source link

Unable to run Ansible modules to manage Nexus dashboard #2

Closed younesjellabi closed 3 years ago

younesjellabi commented 3 years ago

We setup a nexus dashboard cluster version 2.0.2h.

We want to use Ansible to manage Nexus dashboard, and it fails

we followed the Cisco Documentation to install the collection 'ansible-nd' https://github.com/CiscoDevNet/ansible-nd?fbclid=IwAR0jkIPOzr7_AzoWUkY4ZYJb0Nkz0PkE-Ub2pOxztk8LqloboK5WwGUiAE4 and we changed the host parameters as follows :

    ansible_connection=ansible.netcommon.httpapi
    ansible_network_os=cisco.nd.nd

But it still fails. Here under the playbook


and here is the failure log

The full traceback is: File "/tmp/ansible_cisco.nd.nd_version_payload_r1vx6i5n/ansible_cisco.nd.nd_version_payload.zip/ansible_collections/cisco/nd/plugins/module_utils/nd.py", line 201, in request info = conn.send_request(method, uri, json.dumps(data)) File "/tmp/ansible_cisco.nd.nd_version_payload_r1vx6i5n/ansible_cisco.nd.nd_version_payload.zip/ansible/module_utils/connection.py", line 195, in rpc raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code) fatal: [mso]: FAILED! => { "changed": false, "current": {}, "data": null, "invocation": { "module_args": { "host": "172.25.1.4", "login_domain": "local", "output_level": "debug", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "port": null,

{ "changed": false, "data": null, "current": {}, "msg": { "error": "Could not authenticate successfully", "statusCode": 500 }, "exception": " File \"/tmp/ansible_cisco.nd.nd_version_payload_r1vx6i5n/ansible_cisco.nd.nd_version_payload.zip/ansible_collections/cisco/nd/plugins/module_utils/nd.py\", line 201, in request\n info = conn.send_request(method, uri, json.dumps(data))\n File \"/tmp/ansible_cisco.nd.nd_version_payload_r1vx6i5n/ansible_cisco.nd.nd_version_payload.zip/ansible/module_utils/connection.py\", line 195, in rpc\n raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)\n", "invocation": { "module_args": { "state": "query", "host": "172.25.1.4", "username": "admin", "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "use_proxy": false, "use_ssl": true, "validate_certs": false, "output_level": "debug", "login_domain": "local", "timeout": 30, "port": null } }, "_ansible_no_log": false }

the error message says "Could not authenticate successfully" but we verified username/password/login Domain, and they are ok, could you please help us ?

xinyuezhao commented 3 years ago

Hi @younesjellabi , we looked into this issue and was not able to reproduce it. Would you mind have a try with our latest ansible-nd collection and provide more details if it doesn't work? And also if you use local user, there is no need to specify local_domain param in task.

xinyuezhao commented 3 years ago

@younesjellabi Here is the playbook and inventory file which I used to query ND version.

inventory file [nd] nd nd_host=xxx_nd_host_name username=xxx password="xxx"

[nd:vars] ansible_connection=ansible.netcommon.httpapi ansible_network_os=cisco.nd.nd

lhercot commented 3 years ago

Closing as we couldn't reproduce and provided our code. Feel free to reopen an issue if you still have the issue.