Chef for Deadline: The Missing Link

Written by 
Chef for Deadline: The Missing Link

The latest version of Deadline (version 10.0.25.2 at the time of writing) ships with Puppet and Salt plugins, allowing you to submit maintenance jobs on Deadline clients and use these configuration management tools to bring nodes into their desired state.

script menu pre

I've previously touched on some of the benefits of using configuration management tools. And I've also mentioned that I've got my favorite configuration management tool and you'll probably have yours: as long as we can agree upon the need for it, we're cool :-)

However, it's finally time to lay my cards on the table and tell you I'm a Chef kinda guy. Deadline doesn't ship with a Chef plugin OOTB, so: let's get to work!

What do we need to do exactly? We'll have to write a Chef plugin and a submission script, which we then have to move into the "Miscellaneous" section of the Submit menu.

In true Blue Peter-style ("Here's one we made earlier") we've published the source code on GitHub: https://github.com/escapetechnology/deadline-chef. The git repository contains the Deadline Chef plugin, which can be found in the Chef folder, as well as the submission script, ChefSubmission.py.

Firstly the submission script itself, which is the interface (glue) between a (generic) Deadline job and the (specific) Chef plugin. It provides you with the familiarity of the usual Deadline job dialog, i.e. pool etc. and the settings for Chef, e.g. a log level dropdown. In other words, it exposes the plugin to the user by providing a handy script menu.

Then there's the actual plugin, which handles executing a chef-client run on a Deadline client:

Chef.py: the main plugin file, which contains the Python code that controls the rendering process. In our case, Chef's `chef-client` run;

Chef.param: the plugin configuration settings;

Chef.options: the plugin-specific job settings;

Chef.ico: the plugin's icon.

Once you've grabbed the latest release, copy the plugin into your repository's `plugins` folder and the submission script into your repository's `scripts/Submission` folder. In Super User Mode in the Deadline Monitor go to "Tools > Synchronize Monitor Scripts and Plugins" to load the plugin without restarting Deadline Monitor.

Great! You should now see that the submission script has been added to the "Miscellaneous" section of the Submit menu:

script menu inbetween

Yes, it's not exactly where we want it. So, lastly, let's put the newly added menu item into the right place by using Deadline's feature to configure script menus. This functionality enables you to prune the menu for your users or – like in our case – move a menu item.

In Super User Mode in the Deadline Monitor go to "Tools > Configure Script Menus".

configure script menus chefsubmission

Open up the Miscellaneous menu item and drag the new ChefSubmission item in there.

configure script menus chefsubmission miscellaneous

Now we're here let's "prettify" the ChefSubmission item by renaming it to "Chef" and providing it with an icon.

Select the ChefSubmission item and click on "Edit Selection". Change the "Display Name" from "ChefSubmission" to "Chef". Click on the empty "Script Icon" and browse to the Chef icon, which can be found in the previously downloaded Chef plugin folder: plugins\Chef\Chef.ico). Hit "Ok" to close the "Edit Scripts" dialog.

If you want, you can also reorder the "Miscellaneous" items, but let's just leave them in alphabetical order.

configure script menus chef prettified

Close the "Configure Script Menus" dialog and check out the new Miscellaneous Submit menu:

script menu post

Go ahead and submit a Chef job and see chef-client being run on your Deadline clients with a working Chef installation.

Any comments, issues and even PRs are always welcome!

Related items