Skip to content

Examples using Ansible roles to configure Cisco IOS networking equipment

License

Notifications You must be signed in to change notification settings

mtbutler07/ansible-ios

Repository files navigation

Cisco IOS Ansible Examples

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

Prerequisites

  1. OS that is not Windows - WSL FTW
  2. Ansible 2.8.4
  3. Python 3.7.4
  4. Pipenv or other Python virtual environment

Installing

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

Usage

Run the full Ansible playbook

$ ansible-playbook ios_playbook -i inventory/homelab --ask-vault-pass

  Vault password: hunter2

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Examples using Ansible roles to configure Cisco IOS networking equipment

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published