diff --git a/provisioner/puppet-masterless/provisioner.go b/provisioner/puppet-masterless/provisioner.go index 307ecce38..c1085e2f4 100644 --- a/provisioner/puppet-masterless/provisioner.go +++ b/provisioner/puppet-masterless/provisioner.go @@ -147,6 +147,8 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { newFacts[k] = v } + newFacts["packer_build_name"] = p.config.PackerBuildName + newFacts["packer_builder_type"] = p.config.PackerBuilderType p.config.Facter = newFacts // Validation diff --git a/website/source/docs/provisioners/puppet-masterless.html.markdown b/website/source/docs/provisioners/puppet-masterless.html.markdown index bc65ae812..d0d8e1c95 100644 --- a/website/source/docs/provisioners/puppet-masterless.html.markdown +++ b/website/source/docs/provisioners/puppet-masterless.html.markdown @@ -106,3 +106,17 @@ can contain various template variables, defined below: * `ModulePath` - The paths to the module directories. * `Sudo` - A boolean of whether to `sudo` the command or not, depending on the value of the `prevent_sudo` configuration. + +## Default Facts + +In addition to being able to specify custom Facter facts using the `facter` +configuration, the provisioner automatically defines certain commonly useful +facts: + +* `packer_build_name` is set to the name of the build that Packer is running. + This is most useful when Packer is making multiple builds and you want to + distinguish them in your Hiera hierarchy. + +* `packer_builder_type` is the type of the builder that was used to create the + machine that Puppet is running on. This is useful if you want to run only + certain parts of your Puppet code on systems built with certain builders.