napalm-ansible use with AWX

Hi,

I am trying to use napalm-ansible (https://github.com/napalm-automation/napalm-ansible) with AWX but I can never get the AWX job to recognise it.

I have tried many things but I just can’t get AWX to recognise the napalm-ansible library/module path. No matter what the ‘configured module search path’ is always the same, I guess that needs to reflect the correct location of napalm-ansible?

I have created a venv (nmc) on both task and web containers and installed napalm-ansible there, then setup the venv at the job level in awx. I have configured /etc/ansible/ansible.cfg in the containers but that didn’t help. I tried configuring ansible.cfg that sits in the same directory level as the ansible playbooks in the project, that didn’t help. I tried adding a /library to the project and adding napalm-ansible to it, that didn’t help either. Also tried moving the /library directory to the same level as the playbooks in the project but same result again. Now I have run out of ideas on what to do.

Error output below:

ansible-playbook 2.5.5
config file = /var/lib/awx/projects/nmc_network/ansible.cfg
configured module search path = [u’/usr/lib/python2.7/site-packages/awx/plugins/library’]
ansible python module location = /var/lib/awx/venv/nmc/lib/python2.7/site-packages/ansible
executable location = /var/lib/awx/venv/nmc/bin/ansible-playbook
python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Using /var/lib/awx/projects/nmc_network/ansible.cfg as config file
setting up inventory plugins
Parsed /tmp/awx_27_qz61yV/tmpuzXNvV inventory source with script plugin
Loading callback plugin awx_display of type stdout, v2.0 from /usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/module.pyc
PLAYBOOK: napalm_get.yml *******************************************************
1 plays in napalm_get.yml
PLAY [all] *********************************************************************
META: ran handlers
TASK [Interfaces] **************************************************************
task path: /var/lib/awx/projects/nmc_network/napalm_get.yml:39
<ip.address> attempting to start connection
<ip.address> using connection plugin network_cli
<ip.address> local domain socket does not exist, starting it
<ip.address> control socket path is /var/lib/awx/.ansible/pc/c4e7288eca
<ip.address> <ip.address> ESTABLISH CONNECTION FOR USER: rwilliams on PORT 22 TO ip.address
<ip.address> <ip.address> ssh connection done, setting terminal
<ip.address> <ip.address> loaded terminal plugin for network_os ios
<ip.address> <ip.address> loaded cliconf plugin for network_os ios
<ip.address> <ip.address> firing event: on_open_shell()
<ip.address> <ip.address> ssh connection has completed successfully
<ip.address> connection to remote device started successfully
<ip.address> local domain socket listeners started successfully
<ip.address>
<ip.address> local domain socket path is /var/lib/awx/.ansible/pc/c4e7288eca
fatal: [dummy.hostname]: FAILED! => {
“msg”: “The module napalm_get_facts was not found in configured module paths. Additionally, core modules are missing. If this is a checkout, run ‘git pull --rebase’ to correct this problem.”
}
PLAY RECAP *********************************************************************
dummy.hostname : ok=0 changed=0 unreachable=0 failed=1

thanks
Ryan

I managed to solve this.

Turns out after many days of troubleshooting that the real answer is found in the green section of 22.8 on this page https://docs.ansible.com/ansible-tower/latest/html/administration/tipsandtricks.html. It couldnt be found on my jobs because use fact cache was on and setting the AWS_TASK_ENV is the only way to prevent the module search path from being overwritten