ansible

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnsibleRolesPath is the key defined by the user
	AnsibleRolesPath = "ANSIBLE_ROLE_PATH"
	// AnsibleCollectionsPath is key defined by the user
	AnsibleCollectionsPath = "ANSIBLE_COLLECTION_PATH"
	// AnsibleInventoryPath is key defined by the user
	AnsibleInventoryPath = "ANSIBLE_INVENTORY"
)
View Source
const (
	// AnnotationKeyPolicyRun is the name of an annotation which instructs
	// the provider how to run the corresponding Ansible contents
	AnnotationKeyPolicyRun = "ansible.crossplane.io/runPolicy"
)

Variables

This section is empty.

Functions

func Diff

Diff parses `ansible-runner --check` json output to determine whether there is a diff between the desired and the actual state of the configuration. It returns true if there is a diff.

func GetPolicyRun

func GetPolicyRun(o metav1.Object) string

GetPolicyRun returns the ansible run policy annotation value on the resource.

func SetPolicyRun

func SetPolicyRun(o metav1.Object, name string)

SetPolicyRun sets the ansible run policy annotation of the resource.

Types

type Parameters

type Parameters struct {
	// ansible-galaxy binary path.
	GalaxyBinary string
	// ansible-runner binary path.
	RunnerBinary string
	// WorkingDirPath in which to execute the ansible-runner binary.
	WorkingDirPath  string
	CollectionsPath string
	// The source of this filed is either controller flag `--ansible-roles-path` or the env vars : `ANSIBLE_ROLES_PATH` , DEFAULT_ROLES_PATH`
	RolesPath string
	// the limit on the number of artifact directories to keep for each run
	ArtifactsHistoryLimit int
}

Parameters are minimal needed Parameters to initializes ansible command(s)

func (Parameters) GalaxyInstall

func (p Parameters) GalaxyInstall(ctx context.Context, behaviorVars map[string]string, requirementsType string) error

GalaxyInstall Install non-exists collections/roles with ansible-galaxy cli

func (Parameters) Init

func (p Parameters) Init(ctx context.Context, cr *v1alpha1.AnsibleRun, behaviorVars map[string]string) (*Runner, error)

Init initializes a new runner from parameters nolint: gocyclo

type RunPolicy

type RunPolicy struct {
	Name string
}

RunPolicy represents the run policies of Ansible.

type Runner

type Runner struct {
	Path string // absolute path on disk to a playbook or role depending on what cmdFunc expects

	AnsibleRunPolicy *RunPolicy
	// contains filtered or unexported fields
}

Runner struct holds the configuration to run the cmdFunc

func (*Runner) EnableCheckMode

func (r *Runner) EnableCheckMode(m bool)

EnableCheckMode enable the runner checkMode.

func (*Runner) GetAnsibleRunPolicy

func (r *Runner) GetAnsibleRunPolicy() *RunPolicy

GetAnsibleRunPolicy to retrieve Ansible RunPolicy

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) (io.Reader, error)

Run execute the appropriate cmdFunc

func (*Runner) WriteExtraVar

func (r *Runner) WriteExtraVar(extraVar map[string]interface{}) error

WriteExtraVar write extra var to env/extravars under working directory it creates a non-existent env/extravars file

Jump to

Keyboard shortcuts

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