Skip to content

Chef Client Module

Matthew Kelly edited this page Aug 19, 2016 · 1 revision

Chef is an automation and provisioning software. This module allows you to use the chef-client to run your recipes and cookbooks.

If chef-client is not installed on the machine, this module will attempt to install it for you.

Properties

Key Type Description Values
path string This is the path to where your cookbook or recipes are located -
arguments string [Optional] Specify an additional arguments you wish to use when running chef-client -
cookbook string [Optional] The name of the cookbook you wish you run -
runList string array [Optional] (Only if you pass a cookbook name) This is the names of the recipes within your cookbook, the order passed will be the order they are run [Default] default
recipes string array [Optional] (Only if you didn't pass a cookbook) This is the file names of the recipes to run. The order passed will be the order they are run -

Paint

Cookbook Run Order in Palette

The following is an example of using chef-client with a cookbook in a paint section. This example will specify the recipe run order within the palette:

{
    "paint": [
        {
            "type": "chef-client",
            "path": "C:\\path\\to\\cookbook",
            "cookbook": "dev",
            "runList": [
                "web",
                "sql"
            ]
        }
    ]
}

The above will call chef-client on the dev cookbook, running the recipes in the order of web->sql.

Cookbook Run Order in Default Recipe

The following is an example of using chef-client with a cookbook in a paint section. This example will specify the recipe run order in the default recipe, meaning we don't need to pass a runList:

{
    "paint": [
        {
            "type": "chef-client",
            "path": "C:\\path\\to\\cookbook",
            "cookbook": "dev"
        }
    ]
}

The above will call chef-client on the dev cookbook, running the default recipe.

Direct Recipes Run Order

The following is an example of using chef-client in a paint section, passing in the recipe files explicitly:

{
    "paint": [
        {
            "type": "chef-client",
            "path": "C:\\path\\to\\cookbook",
            "recipes": [
                "web.rb",
                "sql.rb"
            ]
        }
    ]
}

The above will call chef-client running the web.rb and sql.rb recipes.

Erase

The erase section will be identical to the paint section.