Ansible for Junos OS Server Requirements
Juniper Networks provides support for using
Ansible to manage devices running Junos OS. Starting in Ansible
Release 2.1, Ansible natively includes a number of core modules that
can be used to manage devices running Junos OS. In addition, Juniper
Networks provides the
Juniper.junos Ansible role, which is hosted on the Ansible Galaxy website and
includes additional modules for Junos OS.
You install Ansible on a control machine with a UNIX-like operating
system. When you install Ansible, the Ansible core modules for Junos
OS are included in the software. To use the Ansible Galaxy modules,
you must install the
on the Ansible server.
To manually install Ansible, the
Juniper.junos role, and any dependencies, see the following section:
Juniper Networks also provides a Docker image that enables you
to run Ansible for Junos OS as a Docker container. The Docker container
is a lightweight, self-contained system that bundles Ansible, the
Juniper.junos role, and all dependencies into a single
portable container. The Docker image enables you to quickly run Ansible
in interactive mode or as an executable package on any platform that
To use the Ansible for Junos OS Docker image, see the following section:
Installing Ansible, the Juniper.junos Role, and Dependencies
Before you install the
Juniper.junos Ansible role and begin using Ansible for Junos OS, ensure that the
Ansible control machine has the following software installed:
Python 3.5 or later (Recommended version is Python 3.8)
Ansible 2.1 or later
Junos PyEZ (
junos-eznc) Release 2.5.1 or later
For installation instructions and current information about Junos PyEZ, see:
After you install the Ansible for Junos OS dependencies
on the Ansible server, you can install the
Juniper.junos Ansible role from the Ansible
- To install the
Juniper.junosrole on the Ansible server, issue the
ansible-galaxy installcommand and specify the
[user@ansible-cm]$ sudo ansible-galaxy install Juniper.junos
- downloading role 'junos', owned by Juniper - downloading role from https://github.com/Juniper/ansible-junos-stdlib/archive/2.4.1.tar.gz - extracting Juniper.junos to /etc/ansible/roles/Juniper.junos - Juniper.junos (2.4.1) was installed successfully
To use the
juniper_junos_jsnapy module, install Junos Snapsnot Administrator in Python (JSNAPy)
Release 1.1.0 or later on the Ansible control machine. For installation
instructions and current information about JSNAPy, see:
Using the Ansible for Junos OS Docker Image
Docker is a software container platform that is used to package
and run an application and its dependencies in an isolated container.
Juniper Networks provides Ansible
for Junos OS Docker images, which are automatically built for
every release of Ansible for Junos OS. The Docker image includes Python
3, Ansible, Junos PyEZ, the
Juniper.junos Ansible role, and Junos Snapshot Administrator in Python along with
any required dependencies. You can run the container in interactive
mode or use the container as an executable to run your playbooks.
To use the Ansible for Junos OS Docker image on your Ansible control machine:
- Install Docker.
See the Docker website at https://www.docker.com for instructions on installing and configuring Docker on your specific operating system.
- Download the juniper/pyez-ansible Docker image from Docker Hub.
To download the latest image, issue the following command:user@host:~$ docker pull juniper/pyez-ansible
The latest Ansible for Junos OS Docker image is built using the most recently committed code in the Juniper/ansible-junos-stdlib GitHub source repository, which is under active development and might not be stable.
To download a specific image, append the appropriate release tag to the image name, for example, 2.0.0.user@host:~$ docker pull juniper/pyez-ansible:tag
- Run the container.
For instructions on running the container, see the official usage examples at https://github.com/Juniper/ansible-junos-stdlib/blob/master/README.md#docker.