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. The Juniper Networks modules are distributed through the following Ansible collections and roles that are hosted on the Ansible Galaxy website:
-
juniper.device
collection -
Juniper.junos
role
Ansible supports Ansible Content Collections, or collections, starting in Ansible 2.10.
With the introduction of the juniper.device
collection, the modules in
the Juniper.junos
role were duplicated under new names in the
collection and thus retain the same functionality and parameters as the original
modules, with the exception of the provider
parameter. Although the
Juniper.junos
role can coexist with the
juniper.device
collection and will work in later releases, new
features are only being added to the juniper.device
collection going
forward.
You install Ansible on a control node with a Unix-like operating system. You can install Ansible and the Juniper Networks collection or role directly on the control node or you can use 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 manually install Ansible, the juniper.device
collection or
Juniper.junos
role, and any prerequisite software on the Ansible
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 or Juniper.junos
role and begin using Ansible to
manage Junos devices, ensure that the Ansible control node has the following
software installed:
-
Python 3.7 or later (Recommended version is Python 3.8)
-
Ansible 2.5 or later (Ansible 2.10 or later is required to use Ansible collections)
-
Junos PyEZ (
junos-eznc
) Release 2.6.0 or later.For installation instructions and current information about Junos PyEZ, see:
-
The
jxmlease
Python module. -
The
xmltodict
Python module (required for thejuniper.device
collection). -
Junos Snapshot Administrator in Python (JSNAPy) Release 1.3.6 or later (required to use the
jsnapy
andjuniper_junos_jsnapy
modules).For installation instructions and current information about JSNAPy, see:
Install the juniper.device Collection and the Juniper.junos Role
Ansible control nodes running Ansible 2.9 or earlier only support installing the
Juniper.junos
role. On Ansible control nodes running
Ansible 2.10 or later, you can install and use the
juniper.device
collection or the
Juniper.junos
role. However, we recommend migrating
playbooks to use the 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.junos
role and the
juniper.device
collection (depending on the release), 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: