Microservice to deploy Junos Configuration files using Ansible inventory
978
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
Inputs
ansible_host: IP of the devicenetconf_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 connectionansible_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){{inventory_hostname}}.confOutputs
Volumes to mount
inventory: Folder where inventory file is locatedconfig: Folder where all the configuration files are locatedoutputs: Optional folder to get access to all diff when configuration are committed.Below is an example of how to use this container
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"
evpn-microservice ᐅ tree -L 2
.
├── configs/
│ ├── demo-qfx10k2-14.conf
│ ├── demo-qfx10k2-15.conf
├── diffs/
└── inputs/
├── inventory.ini
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
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
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
Content type
Image
Digest
Size
133 MB
Last updated
almost 8 years ago
docker pull jnprautomate/junos-deployer