github.com/kaixiang/packer@v0.5.2-0.20140114230416-1f5786b0d7f1/website/source/docs/provisioners/puppet-masterless.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Puppet (Masterless) Provisioner" 4 --- 5 6 # Puppet (Masterless) Provisioner 7 8 Type: `puppet-masterless` 9 10 The masterless Puppet provisioner configures Puppet to run on the machines 11 by Packer from local modules and manifest files. Modules and manifests 12 can be uploaded from your local machine to the remote machine or can simply 13 use remote paths (perhaps obtained using something like the shell provisioner). 14 Puppet is run in masterless mode, meaning it never communicates to a Puppet 15 master. 16 17 <div class="alert alert-info alert-block"> 18 <strong>Note that Puppet will <em>not</em> be installed automatically 19 by this provisioner.</strong> This provisioner expects that Puppet is already 20 installed on the machine. It is common practice to use the 21 <a href="/docs/provisioners/shell.html">shell provisioner</a> before the 22 Puppet provisioner to do this. 23 </div> 24 25 ## Basic Example 26 27 The example below is fully functional and expects the configured manifest 28 file to exist relative to your working directory: 29 30 <pre class="prettyprint"> 31 { 32 "type": "puppet-masterless", 33 "manifest_file": "site.pp" 34 } 35 </pre> 36 37 ## Configuration Reference 38 39 The reference of available configuration options is listed below. 40 41 Required parameters: 42 43 * `manifest_file` (string) - The manifest file for Puppet to use in order 44 to compile and run a catalog. This file must exist on your local system 45 and will be uploaded to the remote machine. 46 47 Optional parameters: 48 49 * `execute_command` (string) - The command used to execute Puppet. This has 50 various [configuration template variables](/docs/templates/configuration-templates.html) 51 available. See below for more information. 52 53 * `facter` (object, string keys and values) - Additonal 54 [facts](http://puppetlabs.com/puppet/related-projects/facter) to make 55 available when Puppet is running. 56 57 * `hiera_config_path` (string) - The path to a local file with hiera 58 configuration to be uploaded to the remote machine. Hiera data directories 59 must be uploaded using the file provisioner separately. 60 61 * `manifest_dir` (string) - The path to a local directory with manifests 62 to be uploaded to the remote machine. This is useful if your main 63 manifest file uses imports. 64 65 * `module_paths` (array of strings) - This is an array of paths to module 66 directories on your local filesystem. These will be uploaded to the remote 67 machine. By default, this is empty. 68 69 * `prevent_sudo` (boolean) - By default, the configured commands that are 70 executed to run Puppet are executed with `sudo`. If this is true, 71 then the sudo will be omitted. 72 73 * `staging_directory` (string) - This is the directory where all the configuration 74 of Puppet by Packer will be placed. By default this is "/tmp/packer-puppet-masterless". 75 This directory doesn't need to exist but must have proper permissions so that 76 the SSH user that Packer uses is able to create directories and write into 77 this folder. If the permissions are not correct, use a shell provisioner 78 prior to this to configure it properly. 79 80 ## Execute Command 81 82 By default, Packer uses the following command (broken across multiple lines 83 for readability) to execute Puppet: 84 85 ``` 86 {{.FacterVars}}{{if .Sudo}} sudo -E {{end}}puppet apply \ 87 --verbose \ 88 --modulepath='{{.ModulePath}}' \ 89 {{if ne .HieraConfigPath ""}}--hiera_config='{{.HieraConfigPath}}' {{end}} \ 90 {{if ne .ManifestDir ""}}--manifestdir='{{.ManifestDir}}' {{end}} \ 91 --detailed-exitcodes \ 92 {{.ManifestFile}} 93 ``` 94 95 This command can be customized using the `execute_command` configuration. 96 As you can see from the default value above, the value of this configuration 97 can contain various template variables, defined below: 98 99 * `FacterVars` - Shell-friendly string of environmental variables used 100 to set custom facts configured for this provisioner. 101 * `HieraConfigPath` - The path to a hiera configuration file. 102 * `ManifestFile` - The path on the remote machine to the manifest file 103 for Puppet to use. 104 * `ModulePath` - The paths to the module directories. 105 * `Sudo` - A boolean of whether to `sudo` the command or not, depending on 106 the value of the `prevent_sudo` configuration. 107