The "Cisco RADKit Device Provisioning and VLAN Configuration Tool" automates device provisioning tasks and VLAN configuration for Cisco Catalyst switches using Cisco RADKit, streamlining network management processes.
This tool simplifies the process of automating device provisioning and VLAN configuration for Cisco Catalyst switches, enhancing network management efficiency. By leveraging Ansible playbooks, it offers a seamless solution to modify VLAN configurations for Catalyst Switches monitored in the Meraki Dashboard. With the integrated RADKit service, it's possible to execute the Ansible Playbooks without the need to be on the same network as the devices.
The tool consists of three components:
This component retrieves devices from the Meraki Dashboard or Cisco Catalyst Center and transfers them to the RADKit service, along with retrieving the current VLAN configuration.
These playbooks facilitate the configuration of devices through the RADKit service.
Integrate with GitLab CI/CD to automate the execution of Ansible playbooks for creating VLANs and changing L2 interface configurations.
To install and configure the project:
Clone the repository:
git clone https://github.com/pamosima/RADKit-tools radkit-tool
Navigate to the repository directory:
cd radkit-tool
Create a virtual environment:
python3 -m venv .venv
Activate the virtual environment:
source .venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Configure environment variables by editing the bash-script.sh
file:
nano /bash-script.sh
Adjust the environment variables as needed. Example:
export RADKIT_ANSIBLE_CLIENT_PRIVATE_KEY_PASSWORD_BASE64=$(echo -n 'my-password' | base64) export RADKIT_ANSIBLE_IDENTITY="my-username" export RADKIT_ANSIBLE_SERVICE_SERIAL="my-service-id"
Optionally, you can set the environment variable MERAKI_API_KEY
to provide your Meraki Dashboard API key.
export MERAKI_API_KEY="my-meraki-apy-key"
NOTE: If
MERAKI_API_KEY
is not set or is empty, you will be prompted to enter the API key when initializing the Meraki Dashboard API.
Source the bash-script.sh
file to apply the environment variables:
source /bash-script.sh
Install RADKit Service based on the following guide: RADKit Installation Guide
Installation of the Ansible collection is done with ansible-galaxy using the provided .tar.gz file where X.Y.Z is the Ansible collection version (e.g., 0.5.0):
ansible-galaxy collection install ansible-cisco-radkit-X.Y.Z.tar.gz --force
(Optional) Build the Docker image for the GitLab CI/CD runner:
Navigate to the Docker folder:
cd gitlab-cicd/docker
Download the necessary files from RADKit Downloads:
ansible-cisco-radkit-X.Y.Z.tar.gz
file.cisco_radkit_X.Y.Z_pip_linux_x86.tgz
file.Copy the downloaded files into the docker
directory.
Build the Docker image using the following command:
docker build -t radkit-runner .
Once the image is built successfully, you can use it as the base image for your GitLab CI/CD runner.
The Python Click application is located in the python subfolder:
To use the Python Click application:
cd python
python radkit-device-tool.py
a
: Get devices from Meraki Dashboard and write to JSON fileThis option retrieves devices from the Meraki Dashboard and saves the information in a JSON file. This file can be used to upload the devices to the RADKit service. You will be prompted to enter the Meraki API key and select your Meraki organization and network.
b
: Get devices from Catalyst Center and write to JSON fileThis option fetches devices from the Catalyst Center and stores the data in a JSON file. This file can be used to upload the devices to the RADKit service. You will be prompted to enter your Catalyst Center credentials.
c
: Upload devices to RADKit service from JSON fileUse this option to upload devices to the RADKit service from a JSON file. The JSON file can be created from the Meraki Dashboard or Catalyst Center. You will be prompted to enter your RADKit superadmin password.
d
: Upload devices to RADKit service from CSV fileWith this option, you can upload devices to the RADKit service from a CSV file (e.g., devices_example.csv
). You will be prompted to enter your RADKit superadmin password.
e
: Get VLAN list per device from Meraki Dashboard and write to YAML file(s)This option retrieves the VLAN list per device from the Meraki Dashboard and saves it in a YAML file per device. These YAML file(s) can be used as device variables to change L2 interface configurations with the Ansible Playbook l2_interface_config-playbook.yml
.
The Ansible Playbooks are located in the ansible subfolder.
The cisco.radkit.radkit inventory plugin allows you to create a dynamic inventory from a remote RADKit service.
ansible-inventory -i radkit_devices.yml --list --yaml
The connection Plugin allow you to utilize existing Ansible modules, but connect through RADKIT instead of directly via SSH. With connection the plugin, credentials to devices are stored on the remote RADKit service.
This Playbook is using the RADKit Plugins and does a "show version".
ansible-playbook -i radkit_devices.yml show_version-playbook.yml --limit radkit_device_type_IOS_XE
This Playbook is using the RADKit Plugins and configures the L2 interfaces of a Catalyst Switch based on the device variable YAML file which can be created by the python click application.
ansible-playbook -i radkit_devices.yml l2_interface_config-playbook.yml
This Playbook is using the RADKit Plugins and configures VLAN(s) on Catalyst Switches based on vars/vlans.yaml.
ansible-playbook -i radkit_devices.yml vlan_config-playbook.yml
The GitLab CI/CD configuration defines two stages:
deploy_l2_interface_config: This stage is responsible for deploying L2 interface configurations using Ansible playbooks.
l2_interface_config-playbook.yml
.$PIPELINE_NAME
is "l2"
.deploy_vlan_config: This stage is responsible for deploying VLAN configurations using Ansible playbooks.
vlan_config-playbook.yml
.$PIPELINE_NAME
is "vlan"
.The GitLab CI/CD runner for this pipeline is a Docker runner which includes Ansible, sshpass, and the necessary Cisco RADkit components for executing the Ansible playbooks.
Currently, there are no known issues. Please report any bugs or problems using the GitHub Issues section.
If you encounter any issues or need assistance, please create an issue in the GitHub repository for support.
Contributions to this project are welcome! Please refer to the CONTRIBUTING guidelines for instructions on how to contribute.
This project was written and is maintained by the following individuals:
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community