provisioner(converge): add prevent_bootstrap_sudo
This commit is contained in:
parent
fb6a5c5bbc
commit
feab6f096e
|
@ -23,9 +23,10 @@ type Config struct {
|
|||
common.PackerConfig `mapstructure:",squash"`
|
||||
|
||||
// Bootstrapping
|
||||
Bootstrap bool `mapstructure:"bootstrap"`
|
||||
Version string `mapstructure:"version"`
|
||||
BootstrapCommand string `mapstructure:"bootstrap_command"`
|
||||
Bootstrap bool `mapstructure:"bootstrap"`
|
||||
Version string `mapstructure:"version"`
|
||||
BootstrapCommand string `mapstructure:"bootstrap_command"`
|
||||
PreventBootstrapSudo bool `mapstructure:"prevent_bootstrap_sudo"`
|
||||
|
||||
// Modules
|
||||
ModuleDirs []ModuleDir `mapstructure:"module_dirs"`
|
||||
|
@ -87,7 +88,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
|
|||
}
|
||||
|
||||
if p.config.BootstrapCommand == "" {
|
||||
p.config.BootstrapCommand = "curl -s https://get.converge.sh | sh {{if ne .Version \"\"}}-s -- -v {{.Version}}{{end}}"
|
||||
p.config.BootstrapCommand = "curl -s https://get.converge.sh | {{if .Sudo}}sudo {{end}}sh {{if ne .Version \"\"}}-s -- -v {{.Version}}{{end}}"
|
||||
}
|
||||
|
||||
// validate sources and destinations
|
||||
|
@ -133,8 +134,10 @@ func (p *Provisioner) maybeBootstrap(ui packer.Ui, comm packer.Communicator) err
|
|||
|
||||
p.config.ctx.Data = struct {
|
||||
Version string
|
||||
Sudo bool
|
||||
}{
|
||||
Version: p.config.Version,
|
||||
Sudo: !p.config.PreventBootstrapSudo,
|
||||
}
|
||||
command, err := interpolate.Render(p.config.BootstrapCommand, &p.config.ctx)
|
||||
if err != nil {
|
||||
|
|
|
@ -64,6 +64,9 @@ Optional parameters:
|
|||
has various
|
||||
[configuration template variables](/docs/templates/configuration-templates.html) available.
|
||||
|
||||
- `prevent_bootstrap_sudo` (bool) - stop Converge from bootstrapping with
|
||||
administrator privileges via sudo
|
||||
|
||||
### Module Directories
|
||||
|
||||
The provisioner can transfer module directories to the remote host for
|
||||
|
@ -104,11 +107,12 @@ contain various template variables:
|
|||
By default, Packer uses the following command to bootstrap Converge:
|
||||
|
||||
``` {.liquid}
|
||||
curl -s https://get.converge.sh | sh {{if ne .Version ""}}-s -- -v {{.Version}}{{end}}
|
||||
curl -s https://get.converge.sh | {{if .Sudo}}sudo {{end}}sh {{if ne .Version ""}}-s -- -v {{.Version}}{{end}}
|
||||
```
|
||||
|
||||
This command can be customized using the `bootstrap_command` configuration. As you
|
||||
can see from the default values above, the value of this configuration can
|
||||
contain various template variables:
|
||||
|
||||
- `Sudo` - the opposite of `prevent_bootstrap_sudo` from the configuration.
|
||||
- `Version` - `version` from the configuration.
|
||||
|
|
Loading…
Reference in New Issue