Skip to content

Commit

Permalink
Add ability to skip chef registration
Browse files Browse the repository at this point in the history
This change allows a user to skip the bootstrap stage for a machine.
  • Loading branch information
samdunne authored and Sander van Harmelen committed Sep 30, 2016
1 parent c307dc9 commit 628743b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
19 changes: 11 additions & 8 deletions builtin/provisioners/chef/resource_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ type Provisioner struct {
SecretKey string `mapstructure:"secret_key"`
ServerURL string `mapstructure:"server_url"`
SkipInstall bool `mapstructure:"skip_install"`
SkipRegister bool `mapstructure:"skip_register"`
SSLVerifyMode string `mapstructure:"ssl_verify_mode"`
UserName string `mapstructure:"user_name"`
UserKey string `mapstructure:"user_key"`
Expand Down Expand Up @@ -213,16 +214,18 @@ func (r *ResourceProvisioner) Apply(
return err
}

if p.FetchChefCertificates {
o.Output("Fetch Chef certificates...")
if err := p.fetchChefCertificates(o, comm); err != nil {
return err
if !p.SkipRegister {
if p.FetchChefCertificates {
o.Output("Fetch Chef certificates...")
if err := p.fetchChefCertificates(o, comm); err != nil {
return err
}
}
}

o.Output("Generate the private key...")
if err := p.generateClientKey(o, comm); err != nil {
return err
o.Output("Generate the private key...")
if err := p.generateClientKey(o, comm); err != nil {
return err
}
}

if p.VaultJSON != "" {
Expand Down
6 changes: 5 additions & 1 deletion website/source/docs/provisioners/chef.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,17 @@ The following arguments are supported:
machine. This assumes Chef Client is already installed when you run the `chef`
provisioner.

* `skip_register (boolean)` - (Optional) Skip the registration of Chef Client on the remote
machine. This assumes Chef Client is already registered when you run the `chef`
provisioner.

* `ssl_verify_mode (string)` - (Optional) Use to set the verify mode for Chef Client HTTPS
requests.

* `user_name (string)` - (Required) The name of an existing Chef user to use for registering
the new Chef Client and (optionally) configure Chef Vaults.

* `user_key (string)` - (Required) The contents of the user key that will be used to
* `user_key (string)` - (Required) The contents of the user key that will be used to
authenticate with the Chef Server. This can be loaded from a file on disk using the [`file()`
interpolation function](/docs/configuration/interpolation.html#file_path_).

Expand Down

0 comments on commit 628743b

Please sign in to comment.