Code Monkey home page Code Monkey logo

ansible-junos-examples's Introduction

ansible-junos-examples

Project to demonstrate Ansible modules for Junos

In this project you'll find:

  • Examples of playbooks for various Ansible modules for Junos:
    • core - junos_config: add config, delete config, rollback
    • core - junos_facts: collect facts, collect configuration in XML, TEXT or JSON
    • core - junos_command: execute cli commands or RPC on devices
    • core - junos_template: deploy configuration templates on device
  • Vagrant file to start a virtual topology with 2 vSRX

Installation instructions

A virtual topology based on Vagrant and vSRX is provided to help everyone to get started.

Install Vagrant and Vagrant plugin for Junos

Vagrant installation instructions Vagrant plugin installation

vagrant plugin add vagrant-junos

Once Vagrant is installed, you can start the topology

git clone https://github.com/JNPRAutomate/ansible-junos-examples.git
cd ansible-junos-examples
vagrant up

2 devices will be started (vsrx1 & vsrx2). Both devices are connected back to back with 2 interfaces.

ge-0/0/0|                   ge-0/0/0|    
=============               =============
|           | ge-0/0/[1-2]  |           |
|   vsrx1   | ------------- |   vsrx2   |
|           | ------------- |           |
=============               =============

You can connect to both VM in SSH

vagrant ssh vsrx1
vagrant ssh vsrx2

Ansible Core - Examples of playbooks

All playbooks are located in the directory playbook-core/

junos_config

Official documentation on Ansible Website

Add configuration lines on device

Change the hostname of the device
ansible-playbook playbook-core/pb.config.update_hostname.yaml

this operation is idempotent, if executed twice, Ansible will not report change the second time.

Add description on multiple interfaces using a list as input
ansible-playbook playbook-core/pb.config.add_description.yaml

Delete configuration lines on devices

ansible-playbook playbook-core/pb.config.delete_description.yaml

Rollback configuration

ansible-playbook playbook-core/pb.config.rollback.yaml

junos_command

Official documentation on Ansible Website

Execute show system user and get response in JSON & XML

ansible-playbook playbook-core/pb.command.show_version.yaml

Query interface status and validate response with wait_for

ansible-playbook playbook-core/pb.command.show_interface.yaml

Use previous command output to only query interfaces status if interfaces are UP

ansible-playbook playbook-core/pb.command.show_ext_if_up.yaml

junos_facts

Official documentation on Ansible Website

Query facts and configuration in XML format on device

The configuration will be automatically converted from XML to JSON

ansible-playbook playbook-core/pb.facts.get_config_json_xml.yaml

Query configuration in TEXT and save to a file

ansible-playbook playbook-core/pb.facts.get_config_txt.yaml

junos_template

Official documentation on Ansible Website

Generate a snippet of configuration based on a jinja2 template and deploy to device

ansible-playbook playbook-core/pb.template.push_interface.yaml

junos_package

Official documentation on Ansible Website.
Example not available yet

junos_netconf

Official documentation on Ansible Website.
Example not available yet

Ansible Galaxy - Examples of playbooks

junos_jsnapy

Execute multiple tests define with jsnapy

ansible-playbook playbook-galaxy/pb.jsnapy.test_pass.yaml

Generate test files dynamically with a jinja2 template

ansible-playbook playbook-galaxy/pb.jsnapy.template_test.yaml

junos_get_config

Example not available yet

junos_get_facts

Example not available yet

junos_get_table

Example not available yet

junos_install_config

Example not available yet

junos_install_os

Example not available yet

junos_ping

Example not available yet

junos_cli

Example not available yet

junos_rpc

Example not available yet

junos_zeroize

Example not available yet

junos_srx_cluster

Example not available yet

junos_shutdown

Example not available yet

junos_rollback

Example not available yet

ansible-junos-examples's People

Contributors

dgarros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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