The repository contains examples of Ansible roles used to configure different items on Cisco IOS networking equipment.
Sensitive credentials are encrypted using Ansible vault and are not stored in this repo. Example secrets.yaml files are provided with instructions on how to use ansible vault.
When creating a new variable, if it's common among the entire group, they're stored in group_vars otherwise, they're stored in the individual host_vars directory.
Roles Covered:
- Configure NTP Servers
- Setup DNS Servers
- Set Interface Description based on Current CDP/LLDP Neighbors
- Get Running Config
- Save Running Config to Startup Config
- OS that is not Windows - WSL FTW
- Ansible 2.8.4
- Python 3.7.4
- Pipenv or other Python virtual environment
Clone this repo
$ git clone https://github.com/mtbutler07/ansible-ios.git
Install Python 3.7.3
Install Pipenv using Pip
$ python3 -m pip install pipenv -U --user
Install dependencies using Pipenv
$ pipenv install
$ pipenv shell
OR install dependencies using pip
$ python3 -m pip install -r requirements.txt -U --user
Modify the username, password, and enable Password in the sample host_vars secret file for your environment. Rename the file to secrets.yaml and encrypt using Ansible Vault
$ cd inventory/host_vars/lab_switch
$ vi secrets.example.yaml
$ mv secrets.example.yaml secrets.yaml
$ ansible-vault encrypt secrets.yaml
New Vault password: hunter2
Confirm New Vault password: hunter2
Encryption successful
Run the full Ansible playbook
$ ansible-playbook ios_playbook -i inventory/homelab --ask-vault-pass
Vault password: hunter2
This project is licensed under the MIT License - see the LICENSE.md file for details