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


Ansible for Junos OS Overview

Ansible is an IT automation framework that is used for infrastructure configuration management. Ansible supports automating the network infrastructure in addition to the compute and cloud infrastructure. The Juniper Networks Ansible for Junos OS library enables you to use Ansible to accelerate the deployment and more easily manage and configure devices running Junos OS in your network. You can use Ansible to perform specific operational and configuration tasks on devices running Junos OS, including retrieving information, managing the configuration, installing and upgrading Junos OS, and resetting, rebooting, or shutting down managed devices.

Ansible comes in several varieties. You can use the following to manage devices running Junos OS:

  • Ansible Core—Free, open-source, base version of Ansible

  • Red Hat Ansible Tower—Commercial application that is a superset of Ansible Core with additional features such as a visual dashboard, role-based access control, job scheduling, and graphical inventory management

  • AWX—Open-source upstream project for Ansible Tower

Ansible uses a client-server architecture. You install the Ansible software on the control machine, or server, which is a Linux or BSD host that manages one or more nodes. Ansible uses an agentless architecture and thus does not require installing any Ansible-specific software on the managed nodes. Although Ansible typically requires Python on the managed nodes, it is not required when managing devices running Junos OS. Instead, Ansible for Junos OS requires all tasks to run locally on the Ansible server and uses NETCONF and the Junos XML API to interface with managed devices running Junos OS.

Ansible modules model specific resources on managed nodes and ensure that the resource is in a specific state. Ansible typically uses a push model in which the server sends state information to the managed nodes on demand. The managed node executes the job and returns the result to the server. In general, Ansible modules are idempotent such that executing the same playbook or operation multiple times yields the same result, because the modules only apply a change if it’s required.

Ansible is written in Python, but it uses simple YAML syntax to express automation jobs. Thus, Ansible users can get started quickly, because they do not require extensive knowledge of Python 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

  • Reduce the time to deploy new network devices and applications

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

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

  • Improve change management processes

  • Minimize risk and errors through standardization

Additional Resources

This documentation assumes that the reader is familiar with the Ansible framework. For more information about Ansible, including supported operating systems and installation instructions, see the Ansible website at

For more information about the Ansible for Junos OS library and related resources, see: