salt

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

	// The target OS that the workload is using. This value is used to determine whether a
	// Windows or Linux OS is in use. If not specified, this value defaults to `linux`.
	// Supported values for the selection are:
	//
	// `linux` - This denotes that the target runs a Linux or Unix operating system.
	// `windows` - This denotes that the target runs a Windows operating system.
	//
	// Presently this option determines some of the defaults used by the provisioner.
	TargetOS string `mapstructure:"target_os"`
	// The individual state files to be applied by Salt. These files must exist on
	// your local system where Packer is executing. State files are applied in the order
	// in which they appear in the parameter. This option is exclusive
	// with `state_tree`.
	StateFiles []string `mapstructure:"state_files"`
	// A path to the complete Salt State Tree on your local system to be copied to the remote machine as the
	// `staging_directory`. The structure of the State Tree is flexible, however the use of this option assumes
	// that a `top.sls` file is present at the top of the State Tree. The plugin assumes that Salt will evaluate
	// the `top.sls` file and match expressions to determine which individual states should be applied. This action
	// is referred to as a "highstate". This option is exclusive with `state_files`.
	//
	// For more details about states and highstates, refer to the [Salt documentation](https://docs.saltproject.io/en/latest/topics/tutorials/starting_states.html).
	StateTree string `mapstructure:"state_tree"`
	// The directory where files will be uploaded to on the target system. Packer requires write
	// permissions in this directory. Default values are used if this option is not set.
	// The default value used will depend on the value of `target_os`. The default for Linux systems is:
	//
	// “`
	// /tmp/packer-provisioner-salt
	// “`
	//
	// For Windows systems the default is:
	//
	// “`
	// C:/Windows/Temp/packer-provisioner-salt
	// “`
	//
	// Windows paths are recommended to be set using `/` as the delimiter owing to more conventional
	// characters causing issues when this plugin is executed on a Linux system.
	StagingDir string `mapstructure:"staging_directory"`
	// If set to `true`, the contents uploaded to the target system will be removed after
	// applying Salt states. By default this is set to `false`.
	Clean bool `mapstructure:"clean"`
	// A collection of environment variables that will be made available to the Salt process
	// when it is executed. The intended purpose of this facility is to enable secrets or
	// environment-specific information to be consumed when applying Salt states.
	//
	// For example:
	//
	// “`hcl
	// environment_vars = [ "SECRET_VALUE=${ var.build_secret }",
	//                      "CONFIG_VALUE=${ var.config_value }" ]
	// “`
	// This would expose the environment variables `SECRET_VALUE` and `CONFIG_VALUE` to the Salt process.
	// These environment variables can then be consumed within Salt states, for example:
	//
	// “`text
	// {% set secret_value = salt['environ.get']('SECRET_VALUE', 'default_value') %}
	// {% set config_value = salt['environ.get']('CONFIG_VALUE', 'default_value') %}
	// # Echo config value
	// echo config value:
	// cmd.run:
	//  - name: echo {{ config_value }}
	// “`
	EnvVars []string `mapstructure:"environment_vars"`
	// An advanced option used to customize the format of the `environment_vars` supplied to the Salt process.
	// The default format for environment variables is:
	//
	// “`
	// "VARNAME='VARVALUE' "
	// “`
	//
	// **Note:** There is a trailing space in the default value that is required to separate environment varables from each other.
	EnvVarFormat string `mapstructure:"env_var_format"`
	// contains filtered or unexported fields
}

func (*Config) FlatMapstructure

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 FlatConfig

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"`
	TargetOS            *string           `mapstructure:"target_os" cty:"target_os" hcl:"target_os"`
	StateFiles          []string          `mapstructure:"state_files" cty:"state_files" hcl:"state_files"`
	StateTree           *string           `mapstructure:"state_tree" cty:"state_tree" hcl:"state_tree"`
	StagingDir          *string           `mapstructure:"staging_directory" cty:"staging_directory" hcl:"staging_directory"`
	Clean               *bool             `mapstructure:"clean" cty:"clean" hcl:"clean"`
	EnvVars             []string          `mapstructure:"environment_vars" cty:"environment_vars" hcl:"environment_vars"`
	EnvVarFormat        *string           `mapstructure:"env_var_format" cty:"env_var_format" hcl:"env_var_format"`
}

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

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 Provisioner

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

func (*Provisioner) ConfigSpec

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, generatedData map[string]interface{}) error

Jump to

Keyboard shortcuts

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