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 supports using Ansible to manage Junos devices and provides Ansible modules that you can use to perform operational and configuration tasks on the devices. Ansible supports Ansible Content Collections, or collections, starting in Ansible 2.10. The Juniper Networks modules are distributed through the following Ansible collection, which is hosted on the Ansible Galaxy website:

You install Ansible on a control node with a Unix-like operating system. You can install Ansible and the Juniper Networks collection:

  • Directly on the configuration management server

  • Within a Python virtual environment

  • As a Docker container

The Juniper Networks juniper/pyez-ansible Docker image is a lightweight, self-contained system that bundles Ansible, the Juniper Networks modules, and all dependencies into a single portable container. The Docker container enables you to quickly run Ansible in interactive mode or as an executable package on any platform that supports Docker.

To install Ansible and the juniper.device collection under the system-installed Python or in Python virtual environment on the control node, see the following sections:

To use the Ansible for Junos OS Docker image, see the following section:

Prerequisite Software

Before you install the Juniper Networks juniper.device collection and begin using Ansible to manage Junos devices, you must install the following prerequisite software in your selected environment on the Ansible control node. You can install the software under the system-installed Python or in a Python virtual environment.

Install the juniper.device Collection

On Ansible control nodes running Ansible 2.10 or later, you can install the juniper.device collection from the Ansible Galaxy website. Install the collection in the same environment where you installed Ansible and the other prerequisite software.

To install the juniper.device collection:

Issue the ansible-galaxy collection install command and specify the juniper.device collection.

Use 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 Docker images, which are automatically built for every new release of the Juniper Networks modules. The Docker image includes Python 3, Ansible, Junos PyEZ, the juniper.device collection, 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 node:

  1. Install Docker.

    See the Docker website at https://www.docker.com 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:

      Note:

      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, v1.0.0-collections.

  3. 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.