Deploying Chef for Junos OS
Chef for Junos OS Deployment Overview
A Chef for Junos OS deployment consists of the following major components:
Chef server—The server acts as a hub for configuration data. The server stores cookbooks and the node object metadata that describes each registered node managed by the Chef client.
Workstations—You can perform most of your work on a workstation. Use the Chef CLI, called knife, to develop cookbooks and recipes and store them in a local Chef repository. From the workstation, you can synchronize the local repository with your version-control system, upload cookbooks to the Chef server, and perform operations on nodes.
Nodes—A node is any physical or virtual device that is configured for the Chef client to manage. Ruby Interpreter, Native Ohai and junos-ez-stdlib (Ruby Gems) are also installed on all nodes to aid the Chef client in managing the node.
To manage a node, the Chef client running on the node obtains the configuration details, such as recipes, templates, and file distributions, from the Chef server. It also collects detailed data about a node, such as hardware properties, memory and processor usage, networking statistics, kernel data, and hostname using Ohai. The Chef client performs as much of the configuration as possible on the node using Ruby Interpreter and junos-ez-stdlib to help interpret Chef recipes into configuration details.
For a Juniper Networks device to be a Chef node, it must have the Chef client installed and configured on it. See the Chef for Junos OS Release Notes for information about Juniper Networks devices running Junos OS that support the Chef client.
Figure 1 shows the major components of a Chef for Junos OS deployment. For more details about all the components that constitute a Chef deployment, see the Chef documentation at https://docs.chef.io/.

Chef for Junos OS Deployment Overview
The following major steps describe how you deploy Chef for Junos OS:
Set up the Chef server. For more information on setting up the Chef server, see the Chef documentation at https://docs.chef.io/.
Set up the Chef workstation. The major steps for doing so are:
Install the Chef client from https://docs.chef.io/ and Ruby Interpreter on your workstation. You can install both at the same time by using the Chef installer. install the Chef Client for the Workstation installation
Set up the Chef repository (chef-repro) and the version-control system.
Install authentication keys and verify that you can connect to the Chef server from your workstation.
For more information about setting up the Chef workstation, see the Chef documentation at https://docs.chef.io/.
After you have set up the workstation, download the netdev cookbook to the chef-repro repository and extract the cookbook files.
knife cookbook site download netdev
tar -zxvf netdev-n.n.n.tar.gz -C cookbooks
The netdev cookbook is available at the Chef supermarket website at https://supermarket.getchef.com/cookbooks/netdev.
If the Chef client is not already installed on the Junos OS nodes, install the client by using the Chef for Junos OS installation package as described in Installing or Uninstalling the Chef Client on Juniper Networks Devices Running Junos OS.
Note:On Juniper Networks switches running Junos OS with Junos Automation Enhancements, you do not need to install the Chef client because the Chef client and related components are installed with the Junos OS software.
For more information on Junos Automation Enhancements, see Junos Automation Enhancements Documentation.
Configure the Chef client on the Junos OS nodes so that it can connect with the Chef server. For more information, see Configuring the Chef Client on Juniper Networks Devices Running Junos OS.
See Also
Installing or Uninstalling the Chef Client on Juniper Networks Devices Running Junos OS
This topic describes how to install, upgrade, or uninstall the Chef client on Juniper Networks devices running Junos OS.
The Chef client is automatically installed on Juniper Networks switches running Junos OS with Junos Automation Enhancements. If your switch is running Junos OS with Junos Automation Enhancements, skip this installation procedure and configure the Chef client as described in Configuring the Chef Client on Juniper Networks Devices Running Junos OS.
For more information on Junos Automation Enhancements, see Junos Automation Enhancements Documentation.
This topic covers:
- Devices Supporting Chef for Junos OS
- Installing the Chef Client Overview
- Installing or Upgrading the Chef Client on Junos
- Installing the Chef Client on Junos OS evolved
- Using the Chef Client Docker Container
- Uninstalling the Chef Client from the Juniper Networks Device
Devices Supporting Chef for Junos OS
Table 1 shows devices running the Junos OS release and the installation package that we recommend you use to install the Chef client. You can download the package or bundle at Chef for Junos Software Download. .
Device |
Junos OS Version |
Chef Client Installation Package Example |
Support for agent as Docker container |
Compatible Versions of netdev |
---|---|---|---|---|
EX4300 |
Release 15.1X53-D10 or later |
chef-powerpc-11.10.4_1.0.tgz |
– |
– |
MX80MX104 |
Release 14.2R2 or later |
chef-powerpc-11.10.4_1.1.tgz |
– |
– |
MX240MX480MX960 |
Release 14.2R2 or later 14.2 release |
chef-i386-11.10.4_1.1.tgz |
– |
– |
Release 15.1R1 or later 15.1 release |
Chef not supported |
– |
– |
|
Release 16.1R1 through 17.4 |
chef-x86-32-11.10.4_2.0.tgz |
– |
– |
|
Release 18.1R1 |
chef-x86-32-11.10.4_2.1.tgz |
– |
– |
|
Release 18.2R1 through 21.1 |
chef-x86-32-11.10.4_3.0.tgz |
– |
– |
|
OCX1100 |
Release 14.1X53-D20 or later |
Not Applicable |
– |
– |
PTX10003-80CPTX10003-160C |
Release 19.1R1 through 21.4 |
Not Applicable |
– |
– |
Release 19.4R2 through 21.4 (Junos OS Evolved only) |
Not Applicable |
Y |
2.1.0 or later |
|
PTX10008 |
Release 19.4R2 through 21.4 (Junos OS Evolved only) |
Not Applicable |
Y |
2.1.0 or later |
QFX5100 |
Release 13.2X51-D15 or later |
Not Applicable |
– |
– |
Release 15.1X53-D70 or later (Non-TVP based images using JET based packages) |
chef-x86-32-11.10.4_2.0.tgz |
– |
– |
|
Release 18.1R1 |
chef-x86-32-11.10.4_2.1.tgz |
– |
– |
|
Release 18.2R1 through 21.1 |
chef-x86-32-11.10.4_3.0.tgz |
– |
– |
|
QFX10002 |
Release 15.1X53-D20 or later |
Not Applicable |
Not Applicable |
Not Applicable |
Release 15.1X53-D70 or later (TVP Unix SDK based packages across all the branches) |
chef-x86-32-11.10.4_2.0.tgz |
– |
– |
|
Release 18.1R1 |
chef-x86-32-11.10.4_2.1.tgz |
– |
– |
|
Release 18.2R1 through 21.1 |
chef-x86-32-11.10.4_3.0.tgz |
– |
– |
|
QFX10008 |
Release 17.1R1 through 21.1 |
Not Applicable |
– |
– |
QFX10016 |
Release 17.1R1 through 21.1 |
Not Applicable |
– |
– |
QFX5220-32CD QFX5220-128C |
Release 19.4R2 through 21.4 (Junos OS Evolved only) |
Not Applicable |
Y |
2.1.0 or later |
See the Chef for Junos OS Release Notes for information about which Juniper Network devices support Chef clients.
Installing the Chef Client Overview
The Chef client is part of an installation package that includes the Chef client, Ohai, the Ruby Interpreter, and junos-ez-stdlib.
On a device with redundant Routing Engines, you must run the Chef client from the primary Routing Engine.
When the Chef client runs, it obtains an exclusive configuration lock, which it releases after it commits all pending configuration changes. If you enable the reporting add-on on your Enterprise Chef server, the Chef client reports the results of the run back to the server. On successful Chef client runs, the Chef client sends a list of updated resources to the server; on failed Chef client runs, it sends a full exception stacktrace to the server.
The configuration of a resource on a managed node always reflects the resource state defined in the last recipe that was run that contains that resource. For example, if you run a recipe that defines a LAG resource as containing the member links ge-0/0/0 and ge-0/0/1 and then later run a recipe that defines the same LAG resource as containing the member links ge-0/0/2 and ge-0/0/03, the resulting configuration for the LAG on the managed node contains only the member links ge-0/0/2 and ge-0/0/3.
Installing or Upgrading the Chef Client on Junos
To install or upgrade the Chef client on a Juniper Networks device:
The procedure to upgrade a Chef client is the same as that of installation. During an upgrade, the previous version of the Chef client is overwritten with the latest version.
After you install the Chef client, you must configure it as described in Configuring the Chef Client on Juniper Networks Devices Running Junos OS.
Installing the Chef Client on Junos OS evolved
Starting in Junos OS evolved Release 19.1R1, the Junos OS evolved image includes the Chef client package; therefore, you do not need to install Chef client package separately on your device.
Using the Chef Client Docker Container
Starting in Junos OS Evolved Release 19.4R2, certain devices running Junos OS Evolved support running the Chef client as a Docker container. As an alternative to using the Chef client that is integrated into the Junos OS Evolved software image, you can use the Chef client Docker container provided by Juniper Networks. Using a container enables you to use standard Docker tools to manage the container and mount or unmount the Chef client as needed
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 a Docker image for the Chef client on Docker Hub.
When you run the Chef client using the Docker container, the container:
Shares the hostname and network namespace of the host
Uses the host network to communicate with the Chef server
Authenticates to the host using key-based SSH authentication
To use the Chef client Docker container on supported devices:
Uninstalling the Chef Client from the Juniper Networks Device
To uninstall the Chef client from the Juniper Networks device,
use the request system software delete
CLI command to delete
the installed packages. For example:
To delete a Chef client package built by the Junos Extension Toolkit (JET), enter:
user@host> request system software delete chef
To delete the Chef client and related packages built by the Junos SDK, enter:
user@host> request system software delete chef user@host> request system software delete junos-ez-stdlib user@host> request system software delete ruby
Configuring the Chef Client on Juniper Networks Devices Running Junos OS
To enable the Chef client to communicate with the Chef server, you must configure the Chef client after it is installed on the Juniper Networks device.
You must set up the Chef workstation and the Chef server so that they can communicate before you perform this procedure.
To configure the Chef client:
See Also
Configuring the Chef Client on Juniper Networks Devices Running Junos OS Evolved
To enable the Chef client to communicate with the Chef server, you must configure the Chef client on the Juniper Networks device.
You must set up the Chef workstation and the Chef server so that they can communicate before you perform this procedure.
To configure the Chef client: