Update documentation + small fixes

Updated the puppet-masterless documentation
Removed extraneous ConfigTemplate code
This commit is contained in:
c22 2017-01-13 19:11:18 +11:00
parent fbac46af91
commit 80ba99c04f
2 changed files with 37 additions and 32 deletions

View File

@ -63,8 +63,8 @@ type Config struct {
// If true, packer will ignore all exit-codes from a puppet run
IgnoreExitCodes bool `mapstructure:"ignore_exit_codes"`
GuestOSType string `mapstructure:"guest_os_type"`
ConfigTemplate string `mapstructure:"config_template"`
// The Guest OS Type (unix or windows)
GuestOSType string `mapstructure:"guest_os_type"`
}
type guestOSTypeConfig struct {
@ -73,7 +73,7 @@ type guestOSTypeConfig struct {
}
var guestOSTypeConfigs = map[string]guestOSTypeConfig{
provisioner.UnixOSType: guestOSTypeConfig{
provisioner.UnixOSType: {
stagingDir: "/tmp/packer-puppet-masterless",
executeCommand: "cd {{.WorkingDir}} && " +
"{{.FacterVars}} {{if .Sudo}} sudo -E {{end}}" +
@ -84,7 +84,7 @@ var guestOSTypeConfigs = map[string]guestOSTypeConfig{
"{{if ne .ExtraArguments \"\"}}{{.ExtraArguments}} {{end}}" +
"{{.ManifestFile}}",
},
provisioner.WindowsOSType: guestOSTypeConfig{
provisioner.WindowsOSType: {
stagingDir: "C:/Windows/Temp/packer-puppet-masterless",
executeCommand: "cd {{.WorkingDir}} && " +
"{{.FacterVars}} && " +
@ -214,17 +214,6 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
p.config.ExecuteCommand = p.guestOSTypeConfig.executeCommand
}
if p.config.ConfigTemplate != "" {
fi, err := os.Stat(p.config.ConfigTemplate)
if err != nil {
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("Bad config template path: %s", err))
} else if fi.IsDir() {
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("Config template path must be a file: %s", err))
}
}
if errs != nil && len(errs.Errors) > 0 {
return errs
}

View File

@ -59,6 +59,10 @@ Optional parameters:
variables](/docs/templates/engine.html) available. See
below for more information.
- `guest_os_type` (string) - The target guest OS type, either "unix" or
"windows". Setting this to "windows" will cause the provisioner to use
Windows friendly paths and commands. By default, this is "unix".
- `extra_arguments` (array of strings) - This is an array of additional options to
pass to the puppet command when executing puppet. This allows for
customization of the `execute_command` without having to completely replace
@ -99,12 +103,13 @@ multiple manifests you should use `manifest_file` instead.
executed to run Puppet are executed with `sudo`. If this is true, then the
sudo will be omitted.
- `staging_directory` (string) - This is the directory where all the
configuration of Puppet by Packer will be placed. By default this
is "/tmp/packer-puppet-masterless". This directory doesn't need to exist but
must have proper permissions so that the SSH user that Packer uses is able
to create directories and write into this folder. If the permissions are not
correct, use a shell provisioner prior to this to configure it properly.
- `staging_directory` (string) - This is the directory where all the configuration
of Puppet by Packer will be placed. By default this is "/tmp/packer-puppet-masterless"
when guest_os_type unix and "C:/Windows/Temp/packer-puppet-masterless" when windows.
This directory doesn't need to exist but must have proper permissions so that the SSH
user that Packer uses is able to create directories and write into this folder.
If the permissions are not correct, use a shell provisioner prior to this to configure
it properly.
- `working_directory` (string) - This is the directory from which the puppet
command will be run. When using hiera with a relative path, this option
@ -117,17 +122,28 @@ multiple manifests you should use `manifest_file` instead.
By default, Packer uses the following command (broken across multiple lines for
readability) to execute Puppet:
``` liquid
cd {{.WorkingDir}} && \
{{.FacterVars}}{{if .Sudo}} sudo -E {{end}} \
{{if ne .PuppetBinDir \"\"}}{{.PuppetBinDir}}{{end}}puppet apply \
--verbose \
--modulepath='{{.ModulePath}}' \
{{if ne .HieraConfigPath ""}}--hiera_config='{{.HieraConfigPath}}' {{end}} \
{{if ne .ManifestDir ""}}--manifestdir='{{.ManifestDir}}' {{end}} \
--detailed-exitcodes \
{{if ne .ExtraArguments ""}}{{.ExtraArguments}} {{end}} \
{{.ManifestFile}}
```
cd {{.WorkingDir}} &&
{{.FacterVars}} {{if .Sudo}} sudo -E {{end}}
puppet apply --verbose --modulepath='{{.ModulePath}}'
{{if ne .HieraConfigPath ""}}--hiera_config='{{.HieraConfigPath}}' {{end}}
{{if ne .ManifestDir ""}}--manifestdir='{{.ManifestDir}}' {{end}}
--detailed-exitcodes
{{if ne .ExtraArguments ""}}{{.ExtraArguments}} {{end}}
{{.ManifestFile}}
```
The following command is used if guest_os_type is windows:
```
cd {{.WorkingDir}} &&
{{.FacterVars}} &&
puppet apply --verbose --modulepath='{{.ModulePath}}'
{{if ne .HieraConfigPath ""}}--hiera_config='{{.HieraConfigPath}}' {{end}}
{{if ne .ManifestDir ""}}--manifestdir='{{.ManifestDir}}' {{end}}
--detailed-exitcodes
{{if ne .ExtraArguments ""}}{{.ExtraArguments}} {{end}}
{{.ManifestFile}}
```
This command can be customized using the `execute_command` configuration. As you