Merge pull request #5831 from uShip/chef-client-policyfiles
Added Policyfile support to chef-client provisioner
This commit is contained in:
commit
3127bfbcfb
|
@ -56,6 +56,8 @@ type Config struct {
|
||||||
InstallCommand string `mapstructure:"install_command"`
|
InstallCommand string `mapstructure:"install_command"`
|
||||||
KnifeCommand string `mapstructure:"knife_command"`
|
KnifeCommand string `mapstructure:"knife_command"`
|
||||||
NodeName string `mapstructure:"node_name"`
|
NodeName string `mapstructure:"node_name"`
|
||||||
|
PolicyGroup string `mapstructure:"policy_group"`
|
||||||
|
PolicyName string `mapstructure:"policy_name"`
|
||||||
PreventSudo bool `mapstructure:"prevent_sudo"`
|
PreventSudo bool `mapstructure:"prevent_sudo"`
|
||||||
RunList []string `mapstructure:"run_list"`
|
RunList []string `mapstructure:"run_list"`
|
||||||
ServerUrl string `mapstructure:"server_url"`
|
ServerUrl string `mapstructure:"server_url"`
|
||||||
|
@ -82,6 +84,8 @@ type ConfigTemplate struct {
|
||||||
ClientKey string
|
ClientKey string
|
||||||
EncryptedDataBagSecretPath string
|
EncryptedDataBagSecretPath string
|
||||||
NodeName string
|
NodeName string
|
||||||
|
PolicyGroup string
|
||||||
|
PolicyName string
|
||||||
ServerUrl string
|
ServerUrl string
|
||||||
SslVerifyMode string
|
SslVerifyMode string
|
||||||
TrustedCertsDir string
|
TrustedCertsDir string
|
||||||
|
@ -270,6 +274,8 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
||||||
remoteValidationKeyPath,
|
remoteValidationKeyPath,
|
||||||
p.config.ValidationClientName,
|
p.config.ValidationClientName,
|
||||||
p.config.ChefEnvironment,
|
p.config.ChefEnvironment,
|
||||||
|
p.config.PolicyGroup,
|
||||||
|
p.config.PolicyName,
|
||||||
p.config.SslVerifyMode,
|
p.config.SslVerifyMode,
|
||||||
p.config.TrustedCertsDir)
|
p.config.TrustedCertsDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -344,6 +350,8 @@ func (p *Provisioner) createConfig(
|
||||||
remoteKeyPath string,
|
remoteKeyPath string,
|
||||||
validationClientName string,
|
validationClientName string,
|
||||||
chefEnvironment string,
|
chefEnvironment string,
|
||||||
|
policyGroup string,
|
||||||
|
policyName string,
|
||||||
sslVerifyMode string,
|
sslVerifyMode string,
|
||||||
trustedCertsDir string) (string, error) {
|
trustedCertsDir string) (string, error) {
|
||||||
|
|
||||||
|
@ -374,6 +382,8 @@ func (p *Provisioner) createConfig(
|
||||||
ValidationKeyPath: remoteKeyPath,
|
ValidationKeyPath: remoteKeyPath,
|
||||||
ValidationClientName: validationClientName,
|
ValidationClientName: validationClientName,
|
||||||
ChefEnvironment: chefEnvironment,
|
ChefEnvironment: chefEnvironment,
|
||||||
|
PolicyGroup: policyGroup,
|
||||||
|
PolicyName: policyName,
|
||||||
SslVerifyMode: sslVerifyMode,
|
SslVerifyMode: sslVerifyMode,
|
||||||
TrustedCertsDir: trustedCertsDir,
|
TrustedCertsDir: trustedCertsDir,
|
||||||
EncryptedDataBagSecretPath: encryptedDataBagSecretPath,
|
EncryptedDataBagSecretPath: encryptedDataBagSecretPath,
|
||||||
|
@ -688,6 +698,12 @@ node_name "{{.NodeName}}"
|
||||||
{{if ne .ChefEnvironment ""}}
|
{{if ne .ChefEnvironment ""}}
|
||||||
environment "{{.ChefEnvironment}}"
|
environment "{{.ChefEnvironment}}"
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{if ne .PolicyGroup ""}}
|
||||||
|
policy_group "{{.PolicyGroup}}"
|
||||||
|
{{end}}
|
||||||
|
{{if ne .PolicyName ""}}
|
||||||
|
policy_name "{{.PolicyName}}"
|
||||||
|
{{end}}
|
||||||
{{if ne .SslVerifyMode ""}}
|
{{if ne .SslVerifyMode ""}}
|
||||||
ssl_verify_mode :{{.SslVerifyMode}}
|
ssl_verify_mode :{{.SslVerifyMode}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in New Issue