Closed barryconstantly closed 3 months ago
@barryconstantly Did you try to just install napalm-ansible via the Ansible collection:
ansible-galaxy collection install napalm.napalm
If you install it this way, you shouldn't need to add anything to .ansible.cfg
.
Also what error do you see in Tower?
Hi Kirk,
When I run ansible-galaxy, it tells me that napalm-ansible is already installed. I installed with pip as I was first using Ansible CLI.
The error is this:
fatal... FAILED! => {"ansible_facts": {discovered_interpreter_pythong": "/usr/bin/python", "msg": "the python module napalm is required"}
This is a Cisco playbook and note, the Tower server Python version is 3.6.8
Thanks, Barry
You need to pip install napalm
into the Python that Tower is using ("/usr/bin/python").
Also Python 3.6 is no longer supported by either newer versions of Ansible or NAPALM (it is end-of-life)...so you ultimately have an issue there (i.e. you would be forced to use downrev napalm and downrev ansible to even get this to run).
Since you can said you can run Ansible from the command-line, that probably implies your command-line ansible is using a different Python (one with napalm installed).
Anyways it all sounds like Ansible/Ansible-Tower environment issues.
I haven't really looked at Tower but for Ansible AWX you typically create your own Docker image that has all of the dependencies you need installed.
Hi Kirk,
I was able to get this working, hard to explain.
I am using a lab with GNS3 devices, I see some posts Googling, are there any any GNS3 Cisco devices that I can use or does napalam not support GNS3 at all?
Thanks, Barry
@barryconstantly On your GNS3 question, I think so as long as their is a file-system (i.e. dir flash:
works properly). Though you can also probably switch it to some other file-system via NAPALM's optional arguments (but still dir {{ filesystem }}
would need to work properly). Here I am mostly referring to IOS/IOS-XE platform.
Hi Kirk,
Inching forward, dir flash works, napalm_install_replace is failing with this message:
[root@localhost helper_playbook_files]# ansible-playbook napalm_install_replace.yml -e config_file="Mid3-logging-buffered.txt"
PLAY [NAPALM gather information on IOS] ***
TASK [Gathering Facts] ****
[WARNING]: Ignoring timeout(10) for ios_facts
[WARNING]: default value for gather_subset
will be changed to min
from !config
v2.11 onwards
ok: [MidA-Pod3-Switch01.sdwanlab.local]
TASK [Install Config and save diff] *** fatal: [MidA-Pod3-Switch01.sdwanlab.local]: FAILED! => {"changed": false, "msg": "cannot install config: Candidate config could not be applied\n\nFailed to apply command no \tquit\nAborting Rollback.\n\nRollback failed.Reverting back to the original configuration: flash:archiveMay-25-13-47-19.888-2 ...\n\nTotal number of passes: 1\nRollback Done\n\nThe original configuration has been successfully restored.\n"}
PLAY RECAP **** MidA-Pod3-Switch01.sdwanlab.local : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Attached is the current config file (Mid3-as-is) and the "Mid3-logging-buffered.txt" file, I don't see anything wrong with the file. The only thing I did was change th the "no logging buffered" line
Any suggestions?
Thanks, Barry Mid3-as-is.txt Mid3-logging-buffered.txt
Your self-signed certificate around the quit
symbol is wrong. Cisco devices are really annoying here.
You can see this in your error output (where it complains about the 'quit' line):
fatal: [MidA-Pod3-Switch01.sdwanlab.local]: FAILED! => {"changed": false, "msg": "cannot install config: Candidate
config could not be applied\n\nFailed to apply command no \tquit\nAborting Rollback.\n\nRollback failed.Reverting
back to the original configuration: flash:archiveMay-25-13-47-19.888-2 ...\n\nTotal number of passes:
1\nRollback Done\n\nThe original configuration has been successfully restored.\n"}
See the self-signed certificate section here:
Hi Kirk,
That fixed it!! Many thanks for all your quick replies.
Barry
Kirk,
One of your other comments for dir flash:
"On your GNS3 question, I think so as long as their is a file-system (i.e. dir flash: works properly). Though you can also probably switch it to some other file-system via NAPALM's optional arguments (but still dir {{ filesystem }} would need to work properly)."
The GNS3 devices do not have flash file system.
See attached for dir all-filesystems output.
Will any of these work as optional argument?
Or do I have to get the GNS3 admin to configure flash:
Thanks again, Barry
@barryconstantly I don't see any attached files?
Sorry did not attach, here it is:
@barryconstantly Yeah, that won't work. NAPALM IOS/IOS-XE requires a file-sytem that you can secure copy files into. So you would need to create an appropriate file-system on the GNS3 devices.
OK, thanks again kirk
Hi Kirk,
If there is a better way to communicate, please let me know (versus me re-opening the case as I am now mostly troubleshooting..).
I created a flash file system and getting further, now I get this error message:
Thanks, Barry
Nevermind, I fat fingered it! Sorry for the message
Hello,
This is for Ansible Tower, trying to map these last two (2) instructions in the documentation section of napalm-ansible:
if you have installed napalm-ansible via Pip you will need to add library and actions_plugins paths in ansible.cfg. Instructions can be found by running napalm-ansible
I tried running napalm-ansible (after doing proper pip install) and "napalm-ansible" did not work.
Then looking at this section:
$ cat .ansible.cfg
[defaults] library = ~/napalm-ansible/napalm_ansible/modules action_plugins = ~/napalm-ansible/napalm_ansible/plugins/action
Where is this file for Tower installations?
Note that on the same server, I am able to run ansible CLI based playbooks with napalm.
Thanks, Barry