Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Understanding Ansible for Junos OS

You can use Ansible to deploy and manage devices running Junos OS and devices running Junos OS Evolved.

Ansible for Junos OS Overview

Ansible is an IT automation framework that you can use for infrastructure configuration management. Ansible supports automating the network infrastructure in addition to the compute and cloud infrastructure. Juniper Networks supports using Ansible to manage devices running Junos OS and devices running Junos OS Evolved. You can use Ansible to perform operational and configuration tasks on Junos devices. For example, you can retrieve information, manage the configuration, install and upgrade Junos OS, and reset, reboot, or shut down managed devices.

Ansible comes in several varieties. You can use the following applications or packages to manage Junos devices:

  • Ansible Core—Free, open-source, base version of Ansible with only essential modules and plugins

  • Ansible Community—Package that includes ansible-core along with many Ansible Content Collections

  • Red Hat Ansible Automation Platform (AAP)—Commercial application that includes additional features such as a webui, role-based access control (RBAC), and analytics.

Ansible uses a client/server architecture. You install the Ansible software on the control node, which is a Unix-like system that performs operations on one or more managed nodes. Ansible uses an agentless architecture and thus does not require installing any Ansible-specific software on the managed devices. Although Ansible typically requires Python on the managed nodes, it is not required to manage network devices. For Junos devices, the Ansible control node runs the tasks locally and uses the Junos XML API and NETCONF to interface with the devices.

Ansible typically uses a push model in which the server sends state information to the managed nodes on demand. Ansible modules are discrete units of code that perform the requested functions on a node. The managed node executes the job and returns the result to the server. In general, Ansible modules are idempotent. If you execute the same playbook or operation multiple times, it yields the same result because the modules only apply a change if it’s required.

Juniper Networks provides Ansible modules that you can use to manage Junos devices. The Juniper Networks modules are distributed through collections. For more information about the available collections and modules, see Understanding the Ansible for Junos OS Collections and Modules.

Ansible is written in Python, but it uses a simple YAML syntax to express automation jobs. Thus, you can get started quickly because you do not need Python knowledge to use Ansible. Ansible also leverages the Jinja2 templating language to enable dynamic expressions and access to variables.

Benefits of Ansible and Ansible for Junos OS

  • Use a simple, easy-to-learn syntax

  • Accelerate the time to deploy new network devices and applications

  • Provide an efficient and scalable solution for managing large numbers of devices

  • Increase operational efficiency by automating tasks and reducing the manual configuration and management of devices

  • Minimize risks and errors through standardization

  • Improve change management processes

  • Use an agentless architecture

Additional Resources

This documentation assumes that the reader is familiar with the Ansible framework. Table 1 provides resources for using Ansible to manage Junos devices.

Table 1: Ansible for Junos OS Resources

Resource

Description

URL

Ansible for Junos OS documentation

Documentation detailing how to use Ansible to manage Junos devices.

https://www.juniper.net/documentation/product/us/en/ansible-for-junos-os/

Ansible for Junos OS modules overview

Documentation that outlines the different modules available for managing Junos devices.

Understanding the Ansible for Junos OS Collections and Modules

Ansible Galaxy

Ansible Galaxy website.

https://galaxy.ansible.com

Ansible website and documentation

Official Ansible website and documentation.

https://www.ansible.com

https://docs.ansible.com

GitHub repository

Public repository for the Ansible for Junos OS project. This repository includes the most current source code, installation instructions, and release note summaries for all releases.

https://github.com/Juniper/ansible-junos-stdlib/

Juniper Networks juniper.device collection

Download site and API reference documentation for the Juniper Networks juniper.device collection.

https://galaxy.ansible.com/ui/repo/published/juniper/device/

https://galaxy.ansible.com/ui/repo/published/juniper/device/docs/

https://ansible-juniper-collection.readthedocs.io/