Code Monkey home page Code Monkey logo

microservice-junos-deployer's Introduction

Microservice to push configuration to Junos device.

Description

This microservice provides mechanism to deploy configuration to Junos Devices. These configuration files must be generated by any 3rd part solution and will be consume by this container.

Docker image: jnprautomate/junos-deployer

Basic usage

# Pull image from docker
% docker pull jnprautomate/junos-deployer

# Create folder structure
% mkdir {inputs,configs,diffs}

# make inventory for ansible
vim inputs/inventory.ini

% docker run -it --rm \
	-v ${PWD}/inputs:/inventory \
	-v ${PWD}/diffs:/outputs \
	-v ${PWD}/configs:/config \
	jnprautomate/junos-deployer:latest

Data management:

Inputs

  • Ansible Inventory file (inventory.ini) with following elements:
    • ansible_host: IP of the device
    • netconf_port: netconf port uses to connect to devices (default is 830)
    • ansible_ssh_private_key: Private key to use to authenticate against devices (Optional)
    • ansible_ssh_user: Username to use for the connection
    • ansible_ssh_pass: Password to use for the connection (Optional if private key is configured)
  • commit_mode: define how configuration management is. done: merge or replace (optional)
  • Configuration folder where all configuration files are stored with this syntax: {{inventory_hostname}}.conf

Outputs

  • Configuration diff for every devices: One file per device (Optional)

Volumes to mount

  • inventory: Folder where inventory file is located
  • config: Folder where all the configuration files are located
  • outputs: Optional folder to get access to all diff when configuration are committed.

Output example

Below is an example of how to use this container

  • Display inventory
evpn-microservice ᐅ cat inventory/inventory.ini

[demo]
demo-qfx10k2-14    ansible_host=172.25.90.67
demo-qfx10k2-15    ansible_host=172.25.90.68

[demo:vars]
netconf_port=830
ansible_ssh_user=ansible
ansible_ssh_pass=juniper123
ansible_ssh_private_key = "~/.ssh/id_lab_gsbt"
commit_mode="merge"
  • Display list of configs
evpn-microservice ᐅ tree -L 2
.
├── configs/
│   ├── demo-qfx10k2-14.conf
│   ├── demo-qfx10k2-15.conf
├── diffs/
└── inputs/
    ├── inventory.ini
  • Run container to deploy configuration
evpn-microservice ᐅ docker run -it --rm \
	-v ${PWD}/inputs:/inventory \
	-v ${PWD}/diffs:/outputs \
	-v ${PWD}/configs:/config \
	jnprautomate/junos-deployer:latest
	
Deploy configuration to Junos devices
  > Check inventory file
  > Inventory file found (inputs/inventory.ini)
  > Deploy configurations to devices

PLAY [Deploy configuration] *******************************************************************************************

TASK [include_vars] ***************************************************************************************************
ok: [demo-qfx10k2-14]
ok: [demo-qfx10k2-15]

TASK [config-deploy-core : Commit Configuration to devices] ***********************************************************
changed: [demo-qfx10k2-14]
changed: [demo-qfx10k2-15]

PLAY RECAP ************************************************************************************************************
demo-qfx10k2-14            : ok=2    changed=1    unreachable=0    failed=0
demo-qfx10k2-15            : ok=2    changed=1    unreachable=0    failed=0
  • Get list of changes for a given device
evpn-microservice ᐅ cat diffs/demo-qfx10k2-14-diff.log

[edit protocols bgp group underlay]
-    authentication-key "$9$hc1cylKM8N-VtuMXNboajHq.QnEhreMX1Rylv8dVoJGDi.Tz3p0Ik.hrKv7NJGDHqf5Qn9tO36RSreXxVwY24ZzF/CpB.P39tOIR"; ## SECRET-DATA
+    authentication-key "$9$ez0KM8X7-sYg1R7Vs4DjmfTQ/tleWL7VSrM8x-2gDik.PQ69AIEy5QeWXxwsik.fT3n/t01hAprvWLVbgoJZUH9CuOIcQFA01hyr"; ## SECRET-DATA
  • Display all files
evpn-microservice ᐅ tree -L 2
.
├── configs/
│   ├── demo-qfx10k2-14.conf
│   ├── demo-qfx10k2-15.conf
├── diffs/
│   ├── demo-qfx10k2-14-diff.log
│   ├── demo-qfx10k2-15-diff.log
└── inputs/
    ├── inventory.ini

microservice-junos-deployer's People

Contributors

titom73 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sincere32

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.