Closed barryconstantly closed 3 years ago
Did you pip install napalm
?
See install section here (you might need to click on the full readme):
Since AWX is released as a Docker container, it cannot be done like I would with Tower which is supported on a VM (and this would be considered a workaround as well even on Tower).
You are supposed to be able to include in my requirements.yml file as I am doing.
The strange thing is that before I had it defined in my requirements.yml, I got this message: "ERROR! couldn't resolve module/action 'napalm.napalm.napalm_install_config'. This often indicates a misspelling, missing collection, or incorrect module path."
After placing napalm.napalm in my requirements file it gets alot farther and then errors out with the originally posted message, repasted here:
"{ "msg": "the python module napalm is required",....}
Since this is docker, would it not be the correct approach for this to work when it loads the collection from requirements.yml?
IIRC requirements.yml is only for collections/roles and does not include Python dependencies (which napalm is). I believe that is correct from reading on it, but if that is incorrect, just let me know.
Your first error above indicates that you didn't have the napalm.napalm
collection installed. Your second error above indicates you do not have the NAPALM library installed (python library).
On just Ansible (not AWX/not tower) the installation process is:
pip install napalm
ansible-galaxy collection install napalm.napalm
I am not a programmer, so bear with me. This is from Tower concerning collections:
Sorry for another post. This is Tower documentation regarding the inclusion of collection in requirements.yml:
"Launching this job template results in the collections being pulled down from Automation Hub and Galaxy and invoking modules made available through those collections"
I thought this implies that modules are supposed to be pulled down as well?
Sorry, I am not a developer if these are dumb questions
Hi Kirk,
I moved away from AWX and installed evaluation version of Tower which runs on normal VM.
Then I did these steps:
Then I did not get the napalm module missing, but this error:
{
"_ansible_no_log": false,
"failed_modules": {
"ios_facts": {
"failed": true,
"exception": "Traceback (most recent call last):\n File \"/var/lib/awx/.ansible/tmp/ansible-local-32QVR8K/ansible-tmp-1621697468.49-13-199521279718636/AnsiballZ_ios_facts.py\", line 102, in
Any ideas? This playbook runs on command line Ansible
It actually had to do with me installing napalm as root. It seemed to have broken Tower as well.
It's just a VM so I am starting over with CentOS 8 to get rid of Python 2/3 issues as well.
https://docs.ansible.com/ansible-tower/latest/html/upgrade-migration-guide/virtualenv.html
I keep you posted the final outcome since I think this will help others using Tower and napalm
This worked with venv, to recap:
"Ansible Tower creates two virtualenvs during installation–one is used to run Tower, while the other is used to run Ansible. This allows Tower to run in a stable environment, while allowing you to add or update modules to your Ansible Python environment as necessary to run your playbooks."
[centos@localhost ~]$ cd /var/lib/awx/venv [centos@localhost venv]$ source ansible/bin/activate (ansible) [centos@localhost venv]$ sudo pip3 install --upgrade pip (ansible) [centos@localhost venv]$ sudo pip3 install napalm
This produced an error with pyYAML package, so I followed these instructions: https://stackoverflow.com/questions/49911550/how-to-upgrade-disutils-package-pyyaml sudo -H pip3 install --ignore-installed PyYAML
All good now on Tower.
Kirk thanks for all the help and the amazing amount of effort you put into napalm.
I am using the napalm_install_config function in my ansible command line playbook and it is working fine. I am using ansible napalm modules in this scenario.
Migrating to AWX which is my normal workflow, I followed the instructions to sync collections using requirements.yml. Note that this file is in my repo and under the collections folder:
collections:
When I run the AWX template which calls the playbook, I get this error:
{"msg": "the python module napalm is required",}
Note the my cisco.ios collection specified in requirements.yml works in another playbook.
Also note that AWX is in a Docker container and managed by kubernties.
This is the playbook:
name: NAPALM gather information on IOS hosts: 10.1.151.10
tasks: