Posts

Showing posts from April, 2022

Using Ansible to Create, Delete and List Tenants

Image
Prepare the Environment In this demonstration I am using Cygwin to run the python/ansible scripts in a Windows environment. All my attempts to install ansible via ‘pip install’ in a Windows failed, the number of Stack Overflow posts reporting this problem seems to concur with this. Handy hint: To cd to a windows C: drive in Cygwin use: [code language="text"] cd /cygdrive/c [/code] To use Ansible with the APIC sandbox host, you will need to first establish a few files before you can start writing your playbooks. Verify that the installed ansible version is 2.8.x, and that it is using Python3: Create ansible.cfg file This file is used by Ansible to tell it that the inventory file is called hosts (unless overridden), to disable gathering of facts by default, and to disable the saving of retry files when playbooks stop with errors: ansible.cfg [code language="python"] [defaults] # Use local hosts file inventory = hosts # Disable automatic fac...

Configure and Verify Cisco ACI Using Acitoolkit

Image
Some instructions and code on how to use the Acitoolkit objects to perform configuration checks against the APIC running state and then create a new Tenant configuration from scratch. Instructions for setting up acitoolkit for the first time are given here: https://acitoolkit.readthedocs.io/en/latest/tutorialsetup.html When trying to use acitoolkit in python for the first time, I got quite a few 'ModuleNotFoundError' messages before succeeding. After overcoming this rabbit-hole after much StackOverflow-ing, I managed to get the acitoolkit working. Definitely ensure the Microsoft Visual C++ components have been installed: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019 You may also get the same problems as I did in needing to do pip installs for acitoolkit, six, websocket, websocket-client and pyrsistent before being able to proceed. What this script does is to import the import the necessary modules for session, tenant, con...

Using Cobra SDK and Arya to create a Tenant

Image
Getting the python and virtual environment set up These instructions are for a Windows set up. Use these instructions for setting up your Python virtual environment and for obtaining and installing the Cobra SDK and model. https://cobra.readthedocs.io/en/latest/install.html But essentially, if you're doing this for the first time, then do the following: Download and install python 2.7 from here (yes, version 2.7) https://www.python.org/downloads/ Download this python script to a chosen location, and run it using python. This will install pip. https://bootstrap.pypa.io/get-pip.py Run these pip commands. I found that I needed to run the pip2 executable as opposed to version 3 pip that was already installed, in order to successfuly install the requirements and run using python2 etc. [code language="txt"] pip install virtualenv pip install virtualenv-clone pip install virtualenvwrapper-win [/code] Run this command to create your virtual environment (See how i...