|
| 1 | +--- |
| 2 | +title: Chef Orchestration in Azure CycleCloud |
| 3 | +description: Learn about Chef orchestration in Azure CycleCloud. Chef is a configuration management tool that automates the deployment and management of applications and infrastructure. |
| 4 | +author: doclayto |
| 5 | +ms.date: 09/23/2025 |
| 6 | +ms.author: dougclayton |
| 7 | +--- |
| 8 | + |
| 9 | +# Chef Orchestration |
| 10 | + |
| 11 | +[Chef](https://www.chef.io) is a configuration management tool that automates the deployment and management of applications and infrastructure. It uses a domain-specific language (DSL) for writing system configuration "recipes". These recipes are stored in "cookbooks" that can be shared and reused across different systems. |
| 12 | + |
| 13 | +Each cluster-init spec can reference one or more [Chef roles](https://docs.chef.io/roles.html) and/or [cookbook recipes](https://docs.chef.io/recipes.html) that need to be executed on the booting VM. |
| 14 | + |
| 15 | +[!NOTE] |
| 16 | +> CycleCloud uses Chef in a stand-alone mode that doesn't rely on a centralized Chef server. The set of Chef cookbooks needed to prepare each VM are downloaded from the Azure Storage Account along with the rest of the files in the project. |
| 17 | +
|
| 18 | +## Project Structure |
| 19 | + |
| 20 | +The **specs** directory in a project can also contain a **chef** subdirectory. |
| 21 | +This directory contains three directories: **site-cookbooks** (for cookbook definitions), **data_bags** (data bag definitions), and **roles** (Chef role definition files): |
| 22 | + |
| 23 | +``` directories |
| 24 | + myproject |
| 25 | + ├── specs |
| 26 | + │ ├── default |
| 27 | + │ └── chef |
| 28 | + │ ├── site-cookbooks |
| 29 | + │ ├── data_bags |
| 30 | + │ └── roles |
| 31 | +``` |
| 32 | + |
| 33 | +## Chef Runlists |
| 34 | + |
| 35 | +You can specify a run_list at the project or spec level within your _project.ini_: |
| 36 | + |
| 37 | +``` ini |
| 38 | +[spec scheduler] |
| 39 | +run_list = role[a], recipe[b] |
| 40 | +``` |
| 41 | + |
| 42 | +When a node includes the `scheduler` spec, the run_list you define automatically appends to any previously defined run_list. For example, if the run_list under `[configuration]` is `run_list = recipe[test]`, the final run_list is `run_list = recipe[cyclecloud], recipe[test], role[a], recipe[b], recipe[cluster_init]`. |
| 43 | + |
| 44 | +You can also overwrite `run_list` at the spec level on a node. This replacement `run_list` removes any `run_list` included in **_project.ini_**. For example, you can change the node definition to the following definition: |
| 45 | + |
| 46 | +``` ini |
| 47 | +[cluster-init test-project:scheduler:1.0.0] |
| 48 | +run_list = recipe[different-test] |
| 49 | +``` |
| 50 | + |
| 51 | +Using this run_list causes the run_list defined in the project to be ignored. The final run_list on the node becomes `run_list = recipe[cyclecloud], recipe[test], recipe[different-test], recipe[cluster_init]`. |
| 52 | + |
| 53 | +## Custom Chef and composable specs |
| 54 | + |
| 55 | +Each spec can contain a **chef** directory. Before you converge a node, the process untars and extracts each spec into the local chef-repo, replacing any existing cookbooks, roles, and data bags with matching names. The process follows the order in which you define the specs, so the last defined spec wins if there's a naming conflict. |
| 56 | + |
| 57 | +## File locations |
| 58 | + |
| 59 | +When you upload your project contents, CycleCloud zips the three custom Chef directories and syncs them to your target locker, at `(locker)/projects/(project)/(version)/(spec_name)/chef`. |
| 60 | + |
| 61 | + |
| 62 | +The node downloads the zipped Chef files during the bootstrapping phase of node startup. The node downloads the files to `$JETPACK_HOME/system/chef/tarballs*`, unzips them to `$JETPACK_HOME/system/chef/chef-repo/`, and uses them to converge the node. |
| 63 | + |
| 64 | +> [!NOTE] |
| 65 | +> To run custom cookbooks, you must add them to the run_list for the node. |
| 66 | +
|
| 67 | + |
| 68 | +## jetpack download |
| 69 | + |
| 70 | +The following example shows how to create a `jetpack_download` lightweight resource provider for Chef users: |
| 71 | + |
| 72 | +``` ini |
| 73 | +jetpack_download "big-file1.tgz" do |
| 74 | + project "my-project" |
| 75 | + end |
| 76 | +``` |
| 77 | + |
| 78 | +In Chef, the default download location is `#{node[:jetpack][:downloads]}`. To change the file destination, use the following code: |
| 79 | + |
| 80 | +``` ini |
| 81 | +jetpack_download "foo.tgz" do |
| 82 | + project "my-project" |
| 83 | + dest "/tmp/download.tgz" |
| 84 | +end |
| 85 | +``` |
| 86 | + |
| 87 | +When you use the command within Chef, you must specify the project. |
0 commit comments