- play_arrow Disclaimer
- play_arrow Ansible Overview
- play_arrow Use Ansible to Connect to Junos Devices
- play_arrow Use Ansible to Manage Device Operations
- Use Ansible to Retrieve Facts from Junos Devices
- Use Ansible to Execute Commands and RPCs on Junos Devices
- Use Ansible to Transfer Files to or from Junos Devices
- Use Ansible with Junos PyEZ Tables to Retrieve Operational Information from Junos Devices
- Use Ansible to Halt, Reboot, or Shut Down Junos Devices
- Use Ansible to Install Software on Junos Devices
- Use Ansible to Restore a Junos Device to the Factory-Default Configuration Settings
- Use Junos Snapshot Administrator in Python (JSNAPy) in Ansible Playbooks
- play_arrow Use Ansible to Manage the Configuration
- play_arrow Troubleshoot Ansible for Junos OS
- Ansible for Junos OS Troubleshooting Summary
- Troubleshoot Junos PyEZ (junos-eznc) Install Errors for Ansible Modules
- Troubleshoot Ansible Collection and Module Errors When Managing Junos Devices
- Troubleshoot Ansible Connection Errors When Managing Junos Devices
- Troubleshoot Ansible Authentication Errors When Managing Junos Devices
- Troubleshoot Ansible Errors When Configuring Junos Devices
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:
juniper.device
collection
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.
Python 3.8 or later
Ansible 2.18 or later
Junos PyEZ (
junos-eznc
) Release 2.6.0 or later.For installation instructions and current information about Junos PyEZ, see:
The
jxmlease
Python moduleThe
looseversion
Python moduleThe
xmltodict
Python moduleJunos Snapshot Administrator in Python (JSNAPy) Release 1.3.6 or later (required to use the
jsnapy
module).For installation instructions and current information about JSNAPy, see:
Install the juniper.device Collection
On the Ansible control node, 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:
ansible-galaxy collection install
command and
specify the juniper.device
collection. user@ansible-cn:~$ ansible-galaxy collection install juniper.device Starting galaxy collection install process Process install dependency map Starting collection install process Installing 'juniper.device:1.0.7' to '/home/user/.ansible/collections/ansible_collections/juniper/device' Downloading https://galaxy.ansible.com/download/juniper-device-1.0.7.tar.gz to /home/user/.ansible/tmp/ansible-local-23916uzdfbjsk/tmp4nhxnw3v juniper.device (1.0.7) was installed successfully
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: