Make PackerBuildName and PackerBuilderType available as Facts during a masterless run similar to the way we do with the Shell provisioner.

pull/1878/head
David Danzilio 11 years ago
parent 8c36684e98
commit d1445bc6fe

@ -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

@ -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.

Loading…
Cancel
Save