Giter VIP home page Giter VIP logo

hackathon-evpn's Introduction

Hackathon Juniper Automation

Theses ansible playbooks will provision a network with ISIS/MPLS and EVPN

"ansible-playbook pb_armageddon.yml" : remove all the configuration from the routers
"ansible-playbook playbooks/pb_deploy.yml" : configure all the setup
"ansible-playbook playbooks/pb_checkall.yml" : check interface status, ISIS adjacency, BGP sessions states and routes.

Whole presentation of the hackathon :

  • ansible-lab/slides.pdf

Network topology

Topology

addressing :
192.168.1.0/24  Backbone
10.X.Y.Z Loopback
X = 1 → P router, X = 2 → PE router
Y = 1 → first router, Y = 2 → second router
Z = 1

Exemples:
router     mgnt/inet 
P1         10.1.1.1
PE1        10.2.1.1 
PE2        10.2.2.1 
PE3        10.2.3.1 
PE4        10.2.4.1 

Ansible

Installation

administrator@server-2:~$ grep export .profile
export PYTHONSTARTUP=/home/administrator/.pythonrc

git clone https://github.com/Glench/Vim-Jinja2-Syntax.git ~/.vim/

sudo ansible-galaxy install Juniper.junos

modules of Juniper.junos are in /etc/ansible/roles/Juniper.junos/library

Basic Ansible knowledge:

hosts                # hosts and groups association (inventory)
playbooks/bp_*       # playbook that makes what yu want
host_vars/           # directory with hosts variables one file/folder per host
group_vars/          # directory with groups variables one file/folder per group
roles/               # directory with the roles

the task is an action done by a module
a module make the action (file copy, template rendering, applying a command...)
a role allow to group tasks and files to reuse them in several playbooks
a play is a set of tasks/roles applied to a group of hosts
a playbook is a set of plays

You can find in a role:

roles/$ROLE/tasks/main.yml : action to run
roles/$ROLE/files/* : file to be copied on the host
roles/$ROLE/templates/* : templates to render
roles/$ROLE/meta/main.yml : list of other roles to run
roles/$ROLE/handler/main.yml : to run via "notify"

Create a role from scratch :

cd ansible-lab/roles
ansible-galaxy init $ROLE

Execution

regular execution : ansible-playbook playbook.yml

run a playbook with arguments : ansible-playbook playbook.yml -e "arg1=foo port=['80']

list of available variables : ansible -m setup hostname/group

Run a command on all hosts (can be set to a group) : ansible all -a "/bin/echo hello"

make a dry run of playbook and show difference without commiting : ansible-playbook pb_deploy.yml --diff --check

run task with only the specific tag and show difference (if any) : ansible-playbook pb_deploy.yml --diff --tags "templating"


Python / pyEz

Installation

pip install junos-eznc

Usage

you will find some scripts in :

  • PyEZ/
cli_run.py : used to run a command on equipement listed in sw_list.yml
deploy.py : used deploy the junos.conf configuration on equipement listed in sw_list.yml
junos.conf : the configuration to deploy (in "display set" format)
sw_list.yml : list of equipement to configure

hackathon-evpn's People

Contributors

afenioux avatar gmazoyer 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.