Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


Chef for Junos OS Overview

Chef Overview

Chef software automates the provisioning and management of compute, networking, and storage resources, whether these resources are on site, in the cloud, or both. Chef software transforms infrastructure into code, enabling you to configure, deploy, and scale in real time, while reducing the risk of human error.

Using Chef, you can write abstract definitions of your infrastructure in Ruby and manage these definitions like you manage source code. These abstract definitions are applied to the nodes in your infrastructure by the Chef clients running on those nodes. When you bring a new node online, the Chef client running on that node needs only to determine which definitions to apply.

DISCLAIMER: Use of Chef for Junos OS software implies acceptance of the terms of the following disclaimer: Chef for Junos OS Disclaimer.

Understanding Cookbooks, Recipes, Resources, and Providers

Within the Chef framework, the abstract infrastructure definitions are contained in reusable cookbooks and recipes:

  • Cookbooks are packages that contain the recipes, files, attribute definitions, and so on that describe a portion of your infrastructure and how to deploy, configure, and manage it. For example, the apache2 cookbook maintained by Chef contains recipes for installing and configuring an Apache HTTP Server.

  • Recipes are written in Ruby and describe the installation, configuration, and management of the infrastructure elements.

  • Resources are the major building blocks of recipes. A resource is a platform-neutral representation of an element of the system and its desired state—for example, a service that should be started or a file that should be written into the file system.

  • Providers are the underlying platform-specific implementations that bring resources to their desired states. For example, a resource might specify a particular software package to be installed, without describing how it is installed. The providers associated with the resource direct the Chef client how to perform the installation on specific platforms.

Chef for Junos OS Overview

Chef for Junos OS allows Juniper Networks devices running Junos OS to be managed by the Chef server. You can use Chef for Junos OS to automate common switching network configurations, such as physical and logical Ethernet link properties and VLANs. See the Chef for Junos OS Release Notes for information about which Juniper Network devices support Chef clients.

Chef for Junos OS supports providers that are specific to Junos OS for the switching resources. These providers translate the configuration modeled by the resources into the Network Configuration Protocol (NETCONF) XML code required to implement the configuration on the device the Chef client is running on.

The netdev cookbook provides a set of vendor-agnostic resources for managing networking devices. Together, the netdev cookbook resources and Junos OS providers enable you to automate your configuration of Juniper Networks devices running Junos OS without requiring knowledge of specific Junos OS CLI commands or XML code.

The netdev cookbook is available at the Chef supermarket website at For more information about the netdev cookbook resources, see Chef for Junos OS at

Benefits of Chef for Junos OS

Benefits of Chef for Junos OS are as follows:

  • Simplifies management and reduces duplication of effort by enabling you to make orchestrated configuration changes across multiple types of devices.

  • Lowers risk and improves compliance through infrastructure automation. For example, by encoding your compliance and security policies as part of a Chef recipe, you can automatically test them before deployment.

  • Automates common switching network configurations, such as physical and logical Ethernet link properties and VLANs.

Features of Chef for Junos OS

Chef for Junos OS provides the following features:

netdev Cookbook Resources

The netdev cookbook, developed and maintained by Chef, contains platform-neutral primitives for the following network resources:

  • Physical interfaces—Physical Ethernet interface attributes, such as administrative state, description, speed, duplex mode, and MTU with the netdev_interface resource

  • Layer 2 Ethernet switching services—Logical Ethernet switching interface attributes, such as description, VLAN membership, and port mode (access or trunk) with the netdev_l2_interface resource

  • Link aggregation groups (LAGs)—LAG interface attributes, such as name, member links, Link Aggregation Control Protocol (LACP) mode, and minimum up links required with the netdev_lag resource

  • VLANs—VLAN attributes, such as name, ID, and description with the netdev_vlan resource

  • Configuration at any hierarchy level—Custom configuration with the netdev_group resource


Juniper Networks OCX1100 switches support only the netdev_interface physical interface resource.

Native Chef Client

The Chef client (chef-client) is an agent that runs locally on every managed node in a Chef deployment and performs the configuration defined in recipes. Chef for Junos OS provides a Chef client that runs natively on supported Juniper Networks devices running Junos OS.

Native Ohai

Ohai is a tool that collects detailed data about a node, such as hardware properties, memory and processor usage, networking statistics, kernel data, and hostname. It provides this data to the Chef client at the start of every Chef client run. This data is also uploaded to the Chef server at the end of each Chef client run, making it available to searches.

Chef for Junos OS provides a version of Ohai that runs natively on supported Juniper Networks devices running Junos OS. This version includes a plug-in that extends Ohai to collect Junos OS and platform-specific attributes. For a description of Ohai options and an example of using Ohai, see the Chef website at

Ruby Interpreter and junos-ez-stdlib

Chef for Junos OS provides a version of the Ruby Interpreter that is compatible with the Chef client. It also provides junos-ez-stdlib, which contains libraries used by the netdev cookbook providers and by Ohai.