Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


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 Juniper.junos role 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 supports Docker.

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:

After you install the Ansible for Junos OS dependencies on the Ansible server, you can install the Juniper.junos Ansible role from the Ansible Galaxy website.

  • To install the Juniper.junos role on the Ansible server, issue the ansible-galaxy install command and specify the Juniper.junos role.
    [user@ansible-cm]$ sudo ansible-galaxy install Juniper.junos

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:

  1. Install Docker.

    See the Docker website at for instructions on installing and configuring Docker on your specific operating system.

  2. Download the juniper/pyez-ansible Docker image from Docker Hub.
    • To download the latest image, issue the following command:


      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.

  3. Run the container.

    For instructions on running the container, see the official usage examples at