CiscoDevNet/python-viptela

No module named api.authentication

tc45 opened this issue · 0 comments

tc45 commented

I have tried running the ansible SDKs on multiple machines, but keep running into the same issues. "No module named api.authentication". I have tried this using Python 3.6, 3.8, and 3.9 all with the same issues. It may be due to how I am 'installing' the role, which is part of the confusion. Clearer instructions on how to get the ansible module installed to where it can be used would be helpful.

I have copied the ansible directory of the SDK to my playbook directory under /roles/ansible-viptela. I have created a virtual environment and installed pip packages for viptela, as well as the requirements.txt file located in the ansible directory. I am calling any number of modules, but focus on just vmanage_device_facts. This is the trace I get when executing the playbook. Thx for helping a newb.

Full trace below:

TASK [GET DEVICE FACTS] *****************************************************************************************************************************************************
task path: /home/ubuntu/sme_call/1.4.2022 - Automation Viptela with Ansible/Ansible_Viptela_module/00-vManage_Automation_using_Ansible_Python_SDK.yml:47
<10.10.20.90> ESTABLISH LOCAL CONNECTION FOR USER: ubuntu
<10.10.20.90> EXEC /bin/sh -c 'echo ~ubuntu && sleep 0'
<10.10.20.90> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/ubuntu/.ansible/tmp"&& mkdir "echo /home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836" && echo ansible-tmp-1641308778.6529593-11303-40442773891836="echo /home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836" ) && sleep 0'
Using module file /home/ubuntu/.local/lib/python3.9/site-packages/ansible/modules/viptela/vmanage_device_facts.py
<10.10.20.90> PUT /home/ubuntu/.ansible/tmp/ansible-local-11219tsxri699/tmpj4pb2crd TO /home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/AnsiballZ_vmanage_device_facts.py
<10.10.20.90> EXEC /bin/sh -c 'chmod u+x /home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/ /home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/AnsiballZ_vmanage_device_facts.py && sleep 0'
<10.10.20.90> EXEC /bin/sh -c '/usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/AnsiballZ_vmanage_device_facts.py && sleep 0'
<10.10.20.90> EXEC /bin/sh -c 'rm -f -r /home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
File "/home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/AnsiballZ_vmanage_device_facts.py", line 102, in
_ansiballz_main()
File "/home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/AnsiballZ_vmanage_device_facts.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/AnsiballZ_vmanage_device_facts.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.viptela.vmanage_device_facts', init_globals=None, run_name='main', alter_sys=True)
File "/usr/lib/python2.7/runpy.py", line 188, in run_module
fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/ansible_vmanage_device_facts_payload_pD702p/ansible_vmanage_device_facts_payload.zip/ansible/modules/viptela/vmanage_device_facts.py", line 10, in
File "/tmp/ansible_vmanage_device_facts_payload_pD702p/ansible_vmanage_device_facts_payload.zip/ansible/module_utils/viptela/vmanage.py", line 2, in
ImportError: No module named api.authentication
fatal: [10.10.20.90]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File "/home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/AnsiballZ_vmanage_device_facts.py", line 102, in \n _ansiballz_main()\n File "/home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/AnsiballZ_vmanage_device_facts.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/home/ubuntu/.ansible/tmp/ansible-tmp-1641308778.6529593-11303-40442773891836/AnsiballZ_vmanage_device_facts.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.viptela.vmanage_device_facts', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib/python2.7/runpy.py", line 188, in run_module\n fname, loader, pkg_name)\n File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File "/usr/lib/python2.7/runpy.py", line 72, in _run_code\n exec code in run_globals\n File "/tmp/ansible_vmanage_device_facts_payload_pD702p/ansible_vmanage_device_facts_payload.zip/ansible/modules/viptela/vmanage_device_facts.py", line 10, in \n File "/tmp/ansible_vmanage_device_facts_payload_pD702p/ansible_vmanage_device_facts_payload.zip/ansible/module_utils/viptela/vmanage.py", line 2, in \nImportError: No module named api.authentication\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}