github.com/jerryclinesmith/packer@v0.3.7/website/source/docs/provisioners/chef-solo.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Chef-Solo Provisioner" 4 --- 5 6 # Chef Solo Provisioner 7 8 Type: `chef-solo` 9 10 The Chef solo provisioner installs and configures software on machines built 11 by Packer using [chef-solo](http://docs.opscode.com/chef_solo.html). Cookbooks 12 can be uploaded from your local machine to the remote machine or remote paths 13 can be used. 14 15 The provisioner will even install Chef onto your machine if it isn't already 16 installed, using the official Chef installers provided by Opscode. 17 18 ## Basic Example 19 20 The example below is fully functional and expects cookbooks in the 21 "cookbooks" directory relative to your working directory. 22 23 <pre class="prettyprint"> 24 { 25 "type": "chef-solo", 26 "cookbook_paths": ["cookbooks"] 27 } 28 </pre> 29 30 ## Configuration Reference 31 32 The reference of available configuration options is listed below. No 33 configuration is actually required, but at least `run_list` is recommended. 34 35 * `cookbook_paths` (array of strings) - This is an array of paths to 36 "cookbooks" directories on your local filesystem. These will be uploaded 37 to the remote machine in the directory specified by the `staging_directory`. 38 By default, this is empty. 39 40 * `execute_command` (string) - The command used to execute Chef. This has 41 various [configuration template variables](/docs/templates/configuration-templates.html) 42 available. See below for more information. 43 44 * `install_command` (string) - The command used to install Chef. This has 45 various [configuration template variables](/docs/templates/configuration-templates.html) 46 available. See below for more information. 47 48 * `remote_cookbook_paths` (array of string) - A list of paths on the remote 49 machine where cookbooks will already exist. These may exist from a previous 50 provisioner or step. If specified, Chef will be configured to look for 51 cookbooks here. By default, this is empty. 52 53 * `json` (object) - An arbitrary mapping of JSON that will be available as 54 node attributes while running Chef. 55 56 * `prevent_sudo` (boolean) - By default, the configured commands that are 57 executed to install and run Chef are executed with `sudo`. If this is true, 58 then the sudo will be omitted. 59 60 * `run_list` (array of strings) - The [run list](http://docs.opscode.com/essentials_node_object_run_lists.html) 61 for Chef. By default this is empty. 62 63 * `skip_install` (boolean) - If true, Chef will not automatically be installed 64 on the machine using the Opscode omnibus installers. 65 66 * `staging_directory` (string) - This is the directory where all the configuration 67 of Chef by Packer will be placed. By default this is "/tmp/packer-chef-solo". 68 This directory doesn't need to exist but must have proper permissions so that 69 the SSH user that Packer uses is able to create directories and write into 70 this folder. If the permissions are not correct, use a shell provisioner 71 prior to this to configure it properly. 72 73 ## Execute Command 74 75 By default, Packer uses the following command (broken across multiple lines 76 for readability) to execute Chef: 77 78 ``` 79 {{if .Sudo}sudo {{end}}chef-solo \ 80 --no-color \ 81 -c {{.ConfigPath}} \ 82 -j {{.JsonPath}} 83 ``` 84 85 This command can be customized using the `execute_command` configuration. 86 As you can see from the default value above, the value of this configuration 87 can contain various template variables, defined below: 88 89 * `ConfigPath` - The path to the Chef configuration file. 90 * `JsonPath` - The path to the JSON attributes file for the node. 91 * `Sudo` - A boolean of whether to `sudo` the command or not, depending on 92 the value of the `prevent_sudo` configuration. 93 94 ## Install Command 95 96 By default, Packer uses the following command (broken across multiple lines 97 for readability) to install Chef. This command can be customized if you want 98 to install Chef in another way. 99 100 ``` 101 curl -L https://www.opscode.com/chef/install.sh | \ 102 {{if .Sudo}}sudo{{end}} bash 103 ``` 104 105 This command can be customized using the `install_command` configuration.