mirror of
https://github.com/myned/ansible-example.git
synced 2025-12-05 22:35:46 +00:00
Example environment for Ansible automation with Cisco networking devices
| inventory | ||
| logs | ||
| playbooks | ||
| .envrc | ||
| .gitattributes | ||
| .gitignore | ||
| ansible.cfg | ||
| LICENSE | ||
| README.md | ||
| requirements.txt | ||
About
Example environment for Ansible automation with Cisco networking devices
Tested with:
- Cisco 2900 router
- Cisco Catalyst 2960 switch
Installation
Prerequisites
- Git
- Python 3.10+
- Internet access
Note
The following instructions assume Ubuntu 22.04 LTS, optionally over WSL
Clone or download this repository
git clone https://github.com/myned/ansible-example
Go to the project directory
cd ansible-example
Install the Python venv package
Note
The exact package varies depending on your distribution
sudo apt update
sudo apt install python3-venv
Create a Python virtual environment
python3 -m venv .venv
Activate the virtual environment
source .venv/bin/activate
Tip
Shells other than bash may use the relevant
activatescripts under.venv/bin/
Install dependencies within the virtual environment
pip install -r requirements.txt
Note
Newer versions of
requirements.txtpackages may be compatible, but have not been tested
Usage
Tip
Example output is available in the
logs/directoryRead through each file, the comments contain additional context
Edit inventory files as necessary
nano inventory/all.yaml
Run the playbook to show configuration
ansible-playbook -i inventory/all.yaml playbooks/show-interfaces.yaml
Run the playbook to modify configuration
ansible-playbook -i inventory/all.yaml playbooks/disable-interfaces.yaml