github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/website/source/docs/provisioners/puppet-server.html.md (about) 1 --- 2 description: | 3 The puppet-server Packer provisioner provisions Packer machines with Puppet 4 by connecting to a Puppet master. 5 layout: docs 6 page_title: 'Puppet Server - Provisioners' 7 sidebar_current: 'docs-provisioners-puppet-server' 8 --- 9 10 # Puppet Server Provisioner 11 12 Type: `puppet-server` 13 14 The `puppet-server` Packer provisioner provisions Packer machines with Puppet by 15 connecting to a Puppet master. 16 17 -> **Note:** Puppet will *not* be installed automatically by this 18 provisioner. This provisioner expects that Puppet is already installed on the 19 machine. It is common practice to use the [shell 20 provisioner](/docs/provisioners/shell.html) before the Puppet provisioner to do 21 this. 22 23 ## Basic Example 24 25 The example below is fully functional and expects a Puppet server to be 26 accessible from your network. 27 28 ``` json 29 { 30 "type": "puppet-server", 31 "options": "--test --pluginsync", 32 "facter": { 33 "server_role": "webserver" 34 } 35 } 36 ``` 37 38 ## Configuration Reference 39 40 The reference of available configuration options is listed below. 41 42 The provisioner takes various options. None are strictly required. They are 43 listed below: 44 45 - `client_cert_path` (string) - Path to the directory on your disk that 46 contains the client certificate for the node. This defaults to nothing, 47 in which case a client cert won't be uploaded. 48 49 - `client_private_key_path` (string) - Path to the directory on your disk that 50 contains the client private key for the node. This defaults to nothing, in 51 which case a client private key won't be uploaded. 52 53 - `facter` (object of key/value strings) - Additional Facter facts to make 54 available to the Puppet run. 55 56 - `ignore_exit_codes` (boolean) - If true, Packer will never consider the 57 provisioner a failure. 58 59 - `options` (string) - Additional command line options to pass to 60 `puppet agent` when Puppet is run. 61 62 - `prevent_sudo` (boolean) - By default, the configured commands that are 63 executed to run Puppet are executed with `sudo`. If this is true, then the 64 sudo will be omitted. 65 66 - `puppet_node` (string) - The name of the node. If this isn't set, the fully 67 qualified domain name will be used. 68 69 - `puppet_server` (string) - Hostname of the Puppet server. By default 70 "puppet" will be used. 71 72 - `staging_dir` (string) - This is the directory where all the 73 configuration of Puppet by Packer will be placed. By default this 74 is /tmp/packer-puppet-server. This directory doesn't need to exist but 75 must have proper permissions so that the SSH user that Packer uses is able 76 to create directories and write into this folder. If the permissions are not 77 correct, use a shell provisioner prior to this to configure it properly. 78 79 - `puppet_bin_dir` (string) - The path to the directory that contains the puppet 80 binary for running `puppet agent`. Usually, this would be found via the `$PATH` 81 or `%PATH%` environment variable, but some builders (notably, the Docker one) do 82 not run profile-setup scripts, therefore the path is usually empty. 83 84 - `guest_os_type` (string) - The target guest OS type, either "unix" or 85 "windows". Setting this to "windows" will cause the provisioner to use 86 Windows friendly paths and commands. By default, this is "unix". 87 88 - `execute_command` (string) - This is optional. The command used to execute Puppet. This has 89 various [configuration template variables](/docs/templates/engine.html) available. By default, 90 Packer uses the following command (broken across multiple lines for readability) to execute Puppet: 91 92 ``` 93 {{.FacterVars}} {{if .Sudo}}sudo -E {{end}} 94 {{if ne .PuppetBinDir ""}}{{.PuppetBinDir}}/{{end}}puppet agent 95 --onetime --no-daemonize 96 {{if ne .PuppetServer ""}}--server='{{.PuppetServer}}' {{end}} 97 {{if ne .Options ""}}{{.Options}} {{end}} 98 {{if ne .PuppetNode ""}}--certname={{.PuppetNode}} {{end}} 99 {{if ne .ClientCertPath ""}}--certdir='{{.ClientCertPath}}' {{end}} 100 {{if ne .ClientPrivateKeyPath ""}}--privatekeydir='{{.ClientPrivateKeyPath}}' {{end}} 101 --detailed-exitcodes 102 ``` 103 104 The following command is used if guest OS type is windows: 105 106 ``` 107 {{.FacterVars}} 108 {{if ne .PuppetBinDir ""}}{{.PuppetBinDir}}/{{end}}puppet agent 109 --onetime --no-daemonize 110 {{if ne .PuppetServer ""}}--server='{{.PuppetServer}}' {{end}} 111 {{if ne .Options ""}}{{.Options}} {{end}} 112 {{if ne .PuppetNode ""}}--certname={{.PuppetNode}} {{end}} 113 {{if ne .ClientCertPath ""}}--certdir='{{.ClientCertPath}}' {{end}} 114 {{if ne .ClientPrivateKeyPath ""}}--privatekeydir='{{.ClientPrivateKeyPath}}' {{end}} 115 --detailed-exitcodes 116 ``` 117 118 ## Default Facts 119 120 In addition to being able to specify custom Facter facts using the `facter` 121 configuration, the provisioner automatically defines certain commonly useful 122 facts: 123 124 - `packer_build_name` is set to the name of the build that Packer is running. 125 This is most useful when Packer is making multiple builds and you want to 126 distinguish them in your Hiera hierarchy. 127 128 - `packer_builder_type` is the type of the builder that was used to create the 129 machine that Puppet is running on. This is useful if you want to run only 130 certain parts of your Puppet code on systems built with certain builders.