Giter Club home page Giter Club logo

ansible-cml-demo's Introduction

Ansible & CML: a Working Walkthrough

Introduction

This repository originally started as a place for me to store my playbooks and scripts for my internal CML test bed during my studies of CML; however, I shortly realized the opportunity that this repository had in helping others with a limited experience with Infrastructure as Code (IaC). It is my goal to build this repository as a practical "how to guide" that is not only a learning tool for Network Engineers to how to set up their first IaC based network, but also a starting point for a practial implementation on their existing network. It is my hope that a Network Engineers can clone this repository in their lab and use the instructions that are in this README to learn about IaC and then using this repository as a springboard to start their own PoC. If you are looking for a way to show your boss the benefits of IaC and network automation than I hope you will find this repository useful.

Acknowledgements and Resources

I used a number of resources to help me put together this repository. Many thanks and appreciation to the creators and organizaitons that put that information out there. Below are the links that I found invaulable and highly recommend that the learner take time to review them:

Before starting this walkthrough, these are the skills you should have

  • a basic knowledge of navigating the Linux Bash Sheel (although you can run this lab on MacOS or Windows, it is easier to do much of this in an Linux environment).
  • a rudimentry knowledge of Python or some basic programming knowledge
  • understand data encoding structures such as JSON and YAML (especially YAML!)
  • a Cisco Modeling Lab (CML) configured and host machine that can access your network devices on the CML instance. You will need to set up external connectivity with a bridge interface on CML to do this.

About the Lab Enviroment

For this lab I used an Ubuntu 20.04.3 LTS VM and CML. The Ubuntu VM housed all my services such as Ansible, SCP, TFTP (for ZTP), and DHCP for my lab. CML ran on the same host as my Ubuntu VM and were connected by a layer 3 bridge allowing me to use an out of band network (OOB) to access the network devices that ran in CML. However, in order to run this enviromenment you do not have to use the same design.

๐Ÿ‘ BONUS: In fact this lab can be replicated on the DevNet Sandbox's Cisco Modeling Labs Enterprise instance. Click here and then type CML in the search box in the upper lefthand side. See screen cap below to see how to get to the sandbox (NOTE: you will need to have to sign in or sign up if you are not already registered with developer.cisco.com):

DevNet Sandbox Screen Cap GIF

Just be aware there are some extra steps you may need to do. Maybe I'lll add those instructions later.

Before you start

  1. Ensure that your envirorment has git installed. If not there are plenty of tutorials that can walk you through this installation process on your host. Just google 'How do I install git for my environment?'

  2. Python should be installed. I used Python 3.6.10 during the creation of this walkthrough; however, check the documentation to be sure you are using the correct version to run ansible. I also highly recommend that you use pyenv to set up python environment. Please see this tutorial that I created that will walk you though setting up pyenv.

  3. Clone this repostitory in your home directory. For example:

    mkdir Ansible-CML
    git clone https://github.com/barweiss45/Ansible_CML.git Ansible-CML
    cd Ansible-CML
    
  4. Install the requirements.txt file located in the Ansible-CML directory with pip.

    pip install -f requirements.txt
    
  5. Verify

Setting up Ansible

Lab Topology

Lab Topology on Lucidcart

Notes on Some Caveats

You may need to make changes your .ssh/config file due to IOSv not accepting some of the newer ssh key algorithms. This can be remediated by creating a .ssh/config file if this does not already exist or updating it if it does existing. It is also suggested to turn StrictHostKeyChecking off when using IOSv and ansible. This is an example of the configuration:

# Assuming that you do not have a ~/.ssh/config file in your home directory.
touch ~/.ssh/config
cd ~/.ssh/

# Use your favorite editor (e.g. Vim, Nano, etc.)
Host <IP or Regex>
    KexAlgorithms +diffie-hellman-group14-sha1
    StrictHostKeyChecking no

ansible-cml-demo's People

Contributors

barweiss45 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.