Use a container ( + PyEZ)
Install juniper/pyez-ansible
DOS Command:
Install python
pip in
stall ansible
Docker image
https://www.juniper.net/documentation/en_US/junos-pyez/topics/task/installation/junos-pyez-server-installing.html
|
|
---|
Ubuntu Desktop 17.1: ( JLK in VMware ) |
Code Block |
---|
title | Ubuntu Desktop 17.1: ( JLK in VMware ) |
---|
collapse | true |
---|
| apt-get install ansible |
|
...
apt-get install python-pip |
|
...
...
#pip install ansible --upgrade |
|
...
apt-get install openssh-server #( to enable SSH ) |
|
...
apt-get install openssh-client build-essential |
|
...
apt-get install libffi-dev libxslt-dev libssl-dev |
|
...
...
...
sudo pip install junos-eznc |
|
...
pip install junos-eznc # ( for access to junos ) |
|
...
#ansible-galaxy will download and "install" the role, "init" will only create the intrastucture of a new role |
|
...
ansible-galaxy install Juniper.junos # ( for access to junos ) |
|
...
>>> quick test: #ansible localhost -m setup |
|
MobaXterm 9.4 |
Code Block |
---|
title | MobaXterm 9.4 |
---|
collapse | true |
---|
| PATH=/drives/c/cygwin64/bin/:$PATH |
|
...
replace alias: alias python='ToolNotIncluded python' >>> alias python='/drives/c/cygwin64/bin/python2.7.exe' |
|
...
apt-get install python-paramiko gcc-g++ wget openssh curl python python-devel python-setuptools python-crypto openssl openssl-devel libffi-devel gcc-g++ python2-openssl gcc-core make |
|
...
apt-get install python #will be 2.7 |
|
Cygwin: | |
...
| https://pip.pypa.io/en/stable/installing/ |
|
...
...
O https://bootstrap.pypa.io/get-pip.py |
|
...
...
pip install ansible
...
2-
3- pip install ansible --upgrade
Usage
...
onmylaptop
https://docs.microsoft.com/en-us/windows/wsl/user-support
2- update and install
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible #did not work# ping google.com to check internet connection
sudo apt-get update
sudo apt-get install ansible
check:
ansible --version
3- Install the python library: PyEZ , jxmlease , nnclient
pip install junos-eznc
pip install ncclient
pip install jxmlease
jlk@jkriker-T460:~$ pip list
ansible (2.7.7)
junos-eznc (2.2.0)
jxmlease (1.0.1)
paramiko (2.4.2)
4- Install the ansible role: Juniper.junos
jlk@jkriker-T460:/etc/ansible/roles$ ansible-galaxy install Juniper.junos
- downloading role 'junos', owned by Juniper
- downloading role from https://github.com/Juniper/ansible-junos-stdlib/archive/2.1.0.tar.gz
- extracting Juniper.junos to /home/jlk/.ansible/roles/Juniper.junos
- Juniper.junos (2.1.0) was installed successfully
5- Usage:
ansible windows -m win_ping
7- change ( or mount this directory )
cd /mnt/c/Users/jkriker/Documents/GitHub/
|
Image Added |
|
Code Block |
---|
| ansible --version
|
|
|
|
|
|