chefsolo

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2021 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

This package implements a provisioner for Packer that uses Chef to provision the remote machine, specifically with chef-solo (that is, without a Chef server).

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigTemplate = `` /* 412-byte string literal not displayed */

Functions

This section is empty.

Types

type Config

type Config struct {
	common.PackerConfig `mapstructure:",squash"`

	ChefEnvironment            string   `mapstructure:"chef_environment"`
	ChefLicense                string   `mapstructure:"chef_license"`
	ConfigTemplate             string   `mapstructure:"config_template"`
	CookbookPaths              []string `mapstructure:"cookbook_paths"`
	RolesPath                  string   `mapstructure:"roles_path"`
	DataBagsPath               string   `mapstructure:"data_bags_path"`
	EncryptedDataBagSecretPath string   `mapstructure:"encrypted_data_bag_secret_path"`
	EnvironmentsPath           string   `mapstructure:"environments_path"`
	ExecuteCommand             string   `mapstructure:"execute_command"`
	InstallCommand             string   `mapstructure:"install_command"`
	RemoteCookbookPaths        []string `mapstructure:"remote_cookbook_paths"`
	// HCL cannot be decoded into an interface so for HCL templates you must use the JsonString option,
	// To be used with https://www.packer.io/docs/templates/hcl_templates/functions/encoding/jsonencode
	// ref: https://github.com/hashicorp/hcl/issues/291#issuecomment-496347585
	JsonString string `mapstructure:"json_string"`
	// For JSON templates we keep the map[string]interface{}
	Json        map[string]interface{} `mapstructure:"json" mapstructure-to-hcl2:",skip"`
	PreventSudo bool                   `mapstructure:"prevent_sudo"`
	RunList     []string               `mapstructure:"run_list"`
	SkipInstall bool                   `mapstructure:"skip_install"`
	StagingDir  string                 `mapstructure:"staging_directory"`
	GuestOSType string                 `mapstructure:"guest_os_type"`
	Version     string                 `mapstructure:"version"`
	// contains filtered or unexported fields
}

func (*Config) FlatMapstructure added in v1.4.5

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type ConfigTemplate

type ConfigTemplate struct {
	CookbookPaths              string
	DataBagsPath               string
	EncryptedDataBagSecretPath string
	RolesPath                  string
	EnvironmentsPath           string
	ChefEnvironment            string
	ChefLicense                string

	// Templates don't support boolean statements until Go 1.2. In the
	// mean time, we do this.
	// TODO(mitchellh): Remove when Go 1.2 is released
	HasDataBagsPath               bool
	HasEncryptedDataBagSecretPath bool
	HasRolesPath                  bool
	HasEnvironmentsPath           bool
}

type ExecuteTemplate

type ExecuteTemplate struct {
	ConfigPath string
	JsonPath   string
	Sudo       bool
}

type FlatConfig added in v1.4.5

type FlatConfig struct {
	PackerBuildName            *string           `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"`
	PackerBuilderType          *string           `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"`
	PackerCoreVersion          *string           `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"`
	PackerDebug                *bool             `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"`
	PackerForce                *bool             `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"`
	PackerOnError              *string           `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"`
	PackerUserVars             map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"`
	PackerSensitiveVars        []string          `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"`
	ChefEnvironment            *string           `mapstructure:"chef_environment" cty:"chef_environment" hcl:"chef_environment"`
	ChefLicense                *string           `mapstructure:"chef_license" cty:"chef_license" hcl:"chef_license"`
	ConfigTemplate             *string           `mapstructure:"config_template" cty:"config_template" hcl:"config_template"`
	CookbookPaths              []string          `mapstructure:"cookbook_paths" cty:"cookbook_paths" hcl:"cookbook_paths"`
	RolesPath                  *string           `mapstructure:"roles_path" cty:"roles_path" hcl:"roles_path"`
	DataBagsPath               *string           `mapstructure:"data_bags_path" cty:"data_bags_path" hcl:"data_bags_path"`
	EncryptedDataBagSecretPath *string           `mapstructure:"encrypted_data_bag_secret_path" cty:"encrypted_data_bag_secret_path" hcl:"encrypted_data_bag_secret_path"`
	EnvironmentsPath           *string           `mapstructure:"environments_path" cty:"environments_path" hcl:"environments_path"`
	ExecuteCommand             *string           `mapstructure:"execute_command" cty:"execute_command" hcl:"execute_command"`
	InstallCommand             *string           `mapstructure:"install_command" cty:"install_command" hcl:"install_command"`
	RemoteCookbookPaths        []string          `mapstructure:"remote_cookbook_paths" cty:"remote_cookbook_paths" hcl:"remote_cookbook_paths"`
	JsonString                 *string           `mapstructure:"json_string" cty:"json_string" hcl:"json_string"`
	PreventSudo                *bool             `mapstructure:"prevent_sudo" cty:"prevent_sudo" hcl:"prevent_sudo"`
	RunList                    []string          `mapstructure:"run_list" cty:"run_list" hcl:"run_list"`
	SkipInstall                *bool             `mapstructure:"skip_install" cty:"skip_install" hcl:"skip_install"`
	StagingDir                 *string           `mapstructure:"staging_directory" cty:"staging_directory" hcl:"staging_directory"`
	GuestOSType                *string           `mapstructure:"guest_os_type" cty:"guest_os_type" hcl:"guest_os_type"`
	Version                    *string           `mapstructure:"version" cty:"version" hcl:"version"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec added in v1.4.5

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.

type InstallChefTemplate

type InstallChefTemplate struct {
	Sudo    bool
	Version string
}

type Provisioner

type Provisioner struct {
	// contains filtered or unexported fields
}

func (*Provisioner) ConfigSpec added in v1.5.0

func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec

func (*Provisioner) Prepare

func (p *Provisioner) Prepare(raws ...interface{}) error

func (*Provisioner) Provision

func (p *Provisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packersdk.Communicator, _ map[string]interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL