#NetCTRL_Script
This script retrieves the hostname from a file and matches it against Netbox to retrieve the IP, then sends configuration to multiple types of switches based on the device type from Netbox. The configuration is from a Jinja2 template.
Follow these steps to set up and run the script:
- Clone the GitHub repository:
git clone https://github.com/user/repo.git - Go into the folder:
cd repo - Create a virtual environment:
python -m venv env - Activate the virtual environment:
source env/bin/activate - Install the dependencies:
python setup.py install
To run the script, use the following command:
python main.py -hThis will display a list of available command line parameters.
Here are some examples of how to use the script:
- Retrieve device information from Netbox and generate configuration:
python main.py -y config.yml- Retrieve device information from Netbox, generate configuration, and send to devices:
python main.py -y config.yml -s- Retrieve device information from Netbox and generate configuration for a specific device:
python main.py -y config.yml -i 192.168.0.1- Retrieve device information from Netbox and generate configuration for a specific device type:
ppython main.py -y config.yml -d cisco_ios- Test that the script is working as expected without actually sending the configuration to devices:
python main.py -y config.yml -t