|
| 1 | +--- |
| 2 | +layout: "docs" |
| 3 | +page_title: "Provisioner: puppet" |
| 4 | +sidebar_current: "docs-provisioners-puppet" |
| 5 | +description: |- |
| 6 | + The `puppet` provisioner installs, configures and runs the Puppet agent on a resource. |
| 7 | +--- |
| 8 | + |
| 9 | +# Puppet Provisioner |
| 10 | + |
| 11 | +The `puppet` provisioner installs, configures and runs the Puppet agent on a |
| 12 | +remote resource. The `puppet` provisioner supports both `ssh` and `winrm` type |
| 13 | +[connections](/docs/provisioners/connection.html). |
| 14 | + |
| 15 | +## Requirements |
| 16 | + |
| 17 | +The `puppet` provisioner has some prerequisites for specific connection types: |
| 18 | + |
| 19 | +* For `ssh` type connections, `cURL` must be available on the remote host. |
| 20 | +* For `winrm` connections, `PowerShell 2.0` must be available on the remote host. |
| 21 | + |
| 22 | +Without these prerequisites, your provisioning execution will fail. |
| 23 | + |
| 24 | +Additionally, the `puppet` provisioner requires |
| 25 | +[Bolt](https://puppet.com/products/bolt) to be installed on your workstation |
| 26 | +with the following [modules |
| 27 | +installed](https://puppet.com/docs/bolt/latest/bolt_installing_modules.html#install-modules) |
| 28 | + |
| 29 | +* `danieldreier/autosign` |
| 30 | +* `puppetlabs/puppet_agent` |
| 31 | + |
| 32 | +## Example usage |
| 33 | + |
| 34 | +```hcl |
| 35 | +resource "aws_instance" "web" { |
| 36 | + # ... |
| 37 | +
|
| 38 | + provisioner "puppet" { |
| 39 | + server = aws_instance.puppetmaster.public_dns |
| 40 | + server_user = "ubuntu" |
| 41 | + extension_requests = { |
| 42 | + pp_role = "webserver" |
| 43 | + } |
| 44 | + } |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +## Argument Reference |
| 49 | + |
| 50 | +The following arguments are supported: |
| 51 | + |
| 52 | +* `server (string)` - (Required) The FQDN of the Puppet master that the agent |
| 53 | + is to connect to. |
| 54 | + |
| 55 | +* `server_user (string)` - (Optional) The user that Bolt should connect to the |
| 56 | + server as (defaults to `root`). |
| 57 | + |
| 58 | +* `os_type (string)` - (Optional) The OS type of the resource. Valid options |
| 59 | + are: `linux` and `windows`. If not supplied, the connection type will be used |
| 60 | + to determine the OS type (`ssh` will assume `linux` and `winrm` will assume |
| 61 | + `windows`). |
| 62 | + |
| 63 | +* `use_sudo (boolean)` - (Optional) If `true`, commands run on the resource |
| 64 | + will have their privileges elevated with sudo (defaults to `true` when the OS |
| 65 | + type is `linux` and `false` when the OS type is `windows`). |
| 66 | + |
| 67 | +* `autosign (boolean)` - (Optional) Set to `true` if the Puppet master is using |
| 68 | + [Daniel Dreier's policy-based autosigning |
| 69 | + tool](https://danieldreier.github.io/autosign) (defaults to `true`). |
| 70 | + |
| 71 | +* `open_source (boolean)` - (Optional) If `true` the open source Puppet agent |
| 72 | + will be installed on the resource, otherwise the Puppet Enterprise agent will |
| 73 | + be installed (defaults to `true`). |
| 74 | + |
| 75 | +* `certname (string)` - (Optional) The Subject CN used when requesting |
| 76 | + a certificate from the Puppet master CA (defaults to the FQDN of the |
| 77 | + resource). |
| 78 | + |
| 79 | +* `extension_request (map)` - (Optional) A map of [extension |
| 80 | + requests](https://puppet.com/docs/puppet/latest/ssl_attributes_extensions.html#concept-932) |
| 81 | + to be embedded in the certificate signing request before it is sent to the |
| 82 | + Puppet master CA and then transferred to the final certificate when the CSR |
| 83 | + is signed. |
| 84 | + |
| 85 | +* `custom_attributes (map)` - (Optional) A map of [custom |
| 86 | + attributes](https://puppet.com/docs/puppet/latest/ssl_attributes_extensions.html#concept-5488) |
| 87 | + to be embedded in the certificate signing request before it is sent to the |
| 88 | + Puppet master CA. |
| 89 | + |
| 90 | +* `environment (string)` - (Optional) The name of the environment which the |
| 91 | + Puppet agent will be running in (defaults to `production`). |
| 92 | + |
| 93 | +* `bolt_timeout (string)` - (Optional) The timeout to wait for Bolt tasks to |
| 94 | + complete. This should be specified as a string like `30s` or `5m` (defaults |
| 95 | + to `5m` - 5 minutes). |
0 commit comments