cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2352
Views
0
Helpful
3
Replies

Where are the Cisco Modules for Ansible

j.a.m.e.s
Level 3
Level 3

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.

 

3 Replies 3

Claudia de Luna
Spotlight
Spotlight

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/

 

 

Sergiu.Daniluk
VIP Alumni
VIP Alumni

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

 

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. 

Getting Started

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: