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

Learn about the requirements for setting up an Ansible control node to manage devices running Junos OS and devices running Junos OS Evolved.

Juniper Networks supports using Ansible to manage devices running Junos OS and devices running Junos OS Evolved. We provide Ansible modules that you can use to perform operational and configuration tasks on your managed devices. The Juniper Networks modules are distributed through the following collection, which is hosted on the Ansible Galaxy website:

Starting in juniper.device Release 2.0.0, we've consolidated the Juniper Networks juniper.device collection and the Red Hat Ansible junipernetworks.junos collection into a single juniper.device collection. When you install the juniper.device collection, you can use juniper.device.module_name to execute modules from either module set. If you want to continue to use existing playbooks that reference junipernetworks.junos.module_name, you must also install the junipernetworks.junos collection. To execute the junipernetworks.junos modules using either namespace, you must define ansible_network_os=juniper.device.junos. Otherwise, everything else remains the same when using the merged set of modules.

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

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:

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 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. We recommend using a Python virtual environment.

Install the juniper.device Collection

On the Ansible control node, you can install the juniper.device collection and the junipernetworks.junos collection from Ansible Galaxy. Install the collections in the same environment where you installed Ansible and the other prerequisite software.

Starting in juniper.device Release 2.0.0, the juniper.device collection includes the juniper.device modules and the junipernetworks.junos modules. You can install just the juniper.device collection and use juniper.device.module-name to execute any module in either module set. If you previously used the junipernetworks.junos modules, and you want to continue using existing playbooks that reference junipernetworks.junos.module-name, then you must also install the junipernetworks.junos collection.

Note:

We recommend that existing junipernetworks.junos collection users install both collections in your Ansible for Junos OS environment.

To install the juniper.device collection and the junipernetworks.junos collection:

  1. Issue the ansible-galaxy collection install command and specify the juniper.device collection.
  2. Issue the ansible-galaxy collection install command and specify the junipernetworks.junos 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 with the Juniper Networks Ansible modules. The Docker image includes Python 3 and Ansible. It also includes the latest versions of the juniper.device collection, Junos PyEZ, and JSNAPy 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.7-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.

Change History Table

Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.

Release
Description
2.0.0
Starting in juniper.device Release 2.0.0, we've merged the Red Hat Ansible junipernetworks.junos modules into the juniper.device collection.