Update documentation + small fixes
Updated the puppet-masterless documentation Removed extraneous ConfigTemplate code
This commit is contained in:
parent
fbac46af91
commit
80ba99c04f
|
@ -63,8 +63,8 @@ type Config struct {
|
||||||
// If true, packer will ignore all exit-codes from a puppet run
|
// If true, packer will ignore all exit-codes from a puppet run
|
||||||
IgnoreExitCodes bool `mapstructure:"ignore_exit_codes"`
|
IgnoreExitCodes bool `mapstructure:"ignore_exit_codes"`
|
||||||
|
|
||||||
GuestOSType string `mapstructure:"guest_os_type"`
|
// The Guest OS Type (unix or windows)
|
||||||
ConfigTemplate string `mapstructure:"config_template"`
|
GuestOSType string `mapstructure:"guest_os_type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type guestOSTypeConfig struct {
|
type guestOSTypeConfig struct {
|
||||||
|
@ -73,7 +73,7 @@ type guestOSTypeConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
||||||
provisioner.UnixOSType: guestOSTypeConfig{
|
provisioner.UnixOSType: {
|
||||||
stagingDir: "/tmp/packer-puppet-masterless",
|
stagingDir: "/tmp/packer-puppet-masterless",
|
||||||
executeCommand: "cd {{.WorkingDir}} && " +
|
executeCommand: "cd {{.WorkingDir}} && " +
|
||||||
"{{.FacterVars}} {{if .Sudo}} sudo -E {{end}}" +
|
"{{.FacterVars}} {{if .Sudo}} sudo -E {{end}}" +
|
||||||
|
@ -84,7 +84,7 @@ var guestOSTypeConfigs = map[string]guestOSTypeConfig{
|
||||||
"{{if ne .ExtraArguments \"\"}}{{.ExtraArguments}} {{end}}" +
|
"{{if ne .ExtraArguments \"\"}}{{.ExtraArguments}} {{end}}" +
|
||||||
"{{.ManifestFile}}",
|
"{{.ManifestFile}}",
|
||||||
},
|
},
|
||||||
provisioner.WindowsOSType: guestOSTypeConfig{
|
provisioner.WindowsOSType: {
|
||||||
stagingDir: "C:/Windows/Temp/packer-puppet-masterless",
|
stagingDir: "C:/Windows/Temp/packer-puppet-masterless",
|
||||||
executeCommand: "cd {{.WorkingDir}} && " +
|
executeCommand: "cd {{.WorkingDir}} && " +
|
||||||
"{{.FacterVars}} && " +
|
"{{.FacterVars}} && " +
|
||||||
|
@ -214,17 +214,6 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
||||||
p.config.ExecuteCommand = p.guestOSTypeConfig.executeCommand
|
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 {
|
if errs != nil && len(errs.Errors) > 0 {
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,10 @@ Optional parameters:
|
||||||
variables](/docs/templates/engine.html) available. See
|
variables](/docs/templates/engine.html) available. See
|
||||||
below for more information.
|
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
|
- `extra_arguments` (array of strings) - This is an array of additional options to
|
||||||
pass to the puppet command when executing puppet. This allows for
|
pass to the puppet command when executing puppet. This allows for
|
||||||
customization of the `execute_command` without having to completely replace
|
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
|
executed to run Puppet are executed with `sudo`. If this is true, then the
|
||||||
sudo will be omitted.
|
sudo will be omitted.
|
||||||
|
|
||||||
- `staging_directory` (string) - This is the directory where all the
|
- `staging_directory` (string) - This is the directory where all the configuration
|
||||||
configuration of Puppet by Packer will be placed. By default this
|
of Puppet by Packer will be placed. By default this is "/tmp/packer-puppet-masterless"
|
||||||
is "/tmp/packer-puppet-masterless". This directory doesn't need to exist but
|
when guest_os_type unix and "C:/Windows/Temp/packer-puppet-masterless" when windows.
|
||||||
must have proper permissions so that the SSH user that Packer uses is able
|
This directory doesn't need to exist but must have proper permissions so that the SSH
|
||||||
to create directories and write into this folder. If the permissions are not
|
user that Packer uses is able to create directories and write into this folder.
|
||||||
correct, use a shell provisioner prior to this to configure it properly.
|
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
|
- `working_directory` (string) - This is the directory from which the puppet
|
||||||
command will be run. When using hiera with a relative path, this option
|
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
|
By default, Packer uses the following command (broken across multiple lines for
|
||||||
readability) to execute Puppet:
|
readability) to execute Puppet:
|
||||||
|
|
||||||
``` liquid
|
```
|
||||||
cd {{.WorkingDir}} && \
|
cd {{.WorkingDir}} &&
|
||||||
{{.FacterVars}}{{if .Sudo}} sudo -E {{end}} \
|
{{.FacterVars}} {{if .Sudo}} sudo -E {{end}}
|
||||||
{{if ne .PuppetBinDir \"\"}}{{.PuppetBinDir}}{{end}}puppet apply \
|
puppet apply --verbose --modulepath='{{.ModulePath}}'
|
||||||
--verbose \
|
{{if ne .HieraConfigPath ""}}--hiera_config='{{.HieraConfigPath}}' {{end}}
|
||||||
--modulepath='{{.ModulePath}}' \
|
{{if ne .ManifestDir ""}}--manifestdir='{{.ManifestDir}}' {{end}}
|
||||||
{{if ne .HieraConfigPath ""}}--hiera_config='{{.HieraConfigPath}}' {{end}} \
|
--detailed-exitcodes
|
||||||
{{if ne .ManifestDir ""}}--manifestdir='{{.ManifestDir}}' {{end}} \
|
{{if ne .ExtraArguments ""}}{{.ExtraArguments}} {{end}}
|
||||||
--detailed-exitcodes \
|
{{.ManifestFile}}
|
||||||
{{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
|
This command can be customized using the `execute_command` configuration. As you
|
||||||
|
|
Loading…
Reference in New Issue