05-11-2020 02:35 PM
Dear All,
I'm getting started with Ansible. I have installed ansible using pip (in a virtual environment):
pipenv install ansible
The ping check is working:
$ ansible -i ./ansible_hosts ios -m ping switch.int.company.com | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false, "ping": "pong" }
Now I would like to create some basic playbooks using ios_command and ios_config. I believe these should be installed in the project folder under ./libraries.
The issue is, where can I obtain these libraries? I've looked on githhub, devnet, ansible.com to no avail...
Thanks in advance for any assistance.
Regards
James.
05-11-2020 03:29 PM
Hi @j.a.m.e.s
The built in modules, like the ones you mentioned, are typically in usr/lib/python2.7/dist-packages/ansible (that was 2.9.2)
Are you having trouble running a playbook?
I have a set of docker containers and "getting started" repositories that might be useful.
https://gratuitous-arp.net/ansible-server-in-docker-for-network-engineers/
05-11-2020 11:48 PM
Hi @j.a.m.e.s
All the available modules, which can be seen categorized here: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html are under:
(venv) sd@ubuntu$ pwd /home/sd/ansible/venv/lib/python3.6/site-packages/ansible/modules (venv) sd@ubuntu$ ls cloud crypto identity messaging network __pycache__ storage web_infrastructure clustering database __init__.py monitoring notification remote_management system windows commands files inventory net_tools packaging source_control utilities
If you want to look at the code of a specific module, you just navigate through the categories and sub-categories. For example, I am interested in a NXOS module. All the network (including NXOS) modules are available, naturally, under the network folder:
https://docs.ansible.com/ansible/latest/modules/list_of_network_modules.html
(venv) sd@ubuntu:$ pwd /home/sd/ansible/venv/lib/python3.6/site-packages/ansible/modules/network/nxos (venv) sd@ubuntu:$ ls __init__.py nxos_igmp_interface.py nxos_ntp.py _nxos_switchport.py nxos_aaa_server_host.py nxos_igmp.py nxos_nxapi.py nxos_system.py nxos_aaa_server.py nxos_igmp_snooping.py nxos_ospf.py nxos_telemetry.py
Hope it helps!
Stay safe,
Sergiu
05-12-2020 01:53 AM - edited 05-12-2020 01:56 AM
Thank you both for your reply. @Sergiu.Daniluk , that was the hint I needed to check my home drive for the virtual environment.
For me the location was this:
:) 10:45 user@machine ~/.local/share/virtualenvs/<pipenvfoldername>/lib/python3.6/site-packages/ansible/modules/network/ios
And it looks like a simple "pipenv install ansible" is enough to bring through IOS/FTD/NXOS/Aireos modules so there is no need to go hunting around for extra modules.
@Claudia de Luna I will check out your docker images at some stage.
Regards
James.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: