arcuser

Start Cooking with the ArcGIS Chef Cookbooks

One of the ways to quickly reduce your workload and simplify maintenance of your GIS is to write scripts that automate common administrative tasks. If you think scripting is writing complicated batch files or shell scripts that are difficult to maintain, let me encourage you to use the ArcGIS Chef Cookbooks. It will make your life easier. This article introduces (or reintroduces) you to a relatively new scripting and automation technology—Chef.

Listing 1 shows a simple recipe that you could use by opening it in a text editor and replacing "domain.com" with the domains you use for ArcGIS Server and Portal for ArcGIS.

What is Chef? Technically, Chef is both a company and an automation platform for working with your infrastructure in the cloud, on-premises, and in hybrid environments. Chef has lots of components, but this article will focus on cookbooks. The cookbook is the fundamental building block of Chef. It is used to define what you’re going to do to automate a task. A cookbook contains recipes that are the actual scripts. Recipes can accomplish very simple tasks, such as installing or uninstalling software, or they can be used to perform more complex tasks, such as assembling and configuring multiple software components across your network so they all work together.

Listing 2 shows how the recipe would look if your domain for ArcGIS Server is yosemite.esri.com, your admin_username is smokey1, and your admin_password is onlyUcan4527.

The Esri Server team has been using Chef for several years to quickly configure virtual machines on-premises and in Amazon Web Services (AWS). As you can imagine, Esri runs ArcGIS software in many different environments to test it, improve its performance, and support customers. Using Chef has saved considerable time and effort and has reduced the stress of constantly installing, uninstalling, updating, and maintaining all Esri machines running ArcGIS. Chef has proved to be a dependable and repeatable solution for automating ArcGIS deployments.

Listing 3 shows how this would work for the portal section of the recipe.

Earlier this year, Esri created a collection of Chef cookbooks for ArcGIS and made them available to all ArcGIS users at the Esri repository on GitHub. Each cookbook has a set of useful Chef recipes that work with different aspects of the ArcGIS platform, including ArcGIS Server, Portal for ArcGIS, ArcGIS Data Store, ArcGIS Web Adaptor, ArcGIS GeoEvent Server, and ArcGIS Pro.

To get started using Chef and the ArcGIS Cookbooks, you will need to have the following items:

Listing 4 shows how you would modify the webgis-windows.json file. You provide the version of your software, the path to your keystore, the keystore_file, keystore_password, and the correct pth to your setup and authorization files.

ArcGIS Cookbooks were designed so you don’t have to write scripts—just modify existing recipes and files to automate simple tasks.

Listing 5 shows a simple recipe for installing and authorizing ArcGIS software

The listings that accompany this article demonstrate how easily you can modify and use recipes. Listings 1 to 4 show how to use an ArcGIS Cookbook recipe to federate an ArcGIS Server with Portal for ArcGIS, a task you can do manually but one that can be automated with Chef. You can use this recipe not only for your initial configuration but later when you have added another ArcGIS Server to your deployment. After making changes to the recipe and saving them, use the Chef Client you installed to run the script by typing “chef-solo -j C:\chef\roles\webgis-windows.json” at the prompt (C:\) in the command prompt window and pressing Return.

If you don’t have ArcGIS installed on a laptop or PC, you might want to try the simple recipe shown in Listing 5 for installing and authorizing ArcGIS Desktop.

To learn more about using the ArcGIS Cookbook, visit the arcgis-cookbook wiki on GitHub.

?>