ansible

package
v1.25.2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ansible is a generic wrapper around ansible

Index

Constants

View Source
const (
	AnsibleCallbackWhiteListVerbose = "profile_tasks"
)

Variables

View Source
var (
	PythonPath  = os.Getenv("PYTHON_PATH")
	AnsiblePath = os.Getenv("ANSIBLE_PATH")
)
View Source
var ErrPlaybookNotStarted = errors.New(
	"playbook not started",
)

Functions

func PrintCmd

func PrintCmd(cmd *exec.Cmd, log io.Writer)

Types

type LoggerConfig

type LoggerConfig struct {
	// Out is the stdout writer for the Ansible process
	Out io.Writer
	// ErrOut is the stderr writer for the Ansible process
	ErrOut io.Writer
	// Output also gets logged to a file
	Log       io.Writer
	Verbosity int
}

func NewLoggerConfig

func NewLoggerConfig(writer io.Writer, verbosity int) *LoggerConfig

type OutputFormat

type OutputFormat string

OutputFormat is used for controlling the STDOUT format of the Ansible runner.

type PlaybookOptions

type PlaybookOptions struct {
	ExtraVars    []string
	ExtraVarsMap map[string]interface{}
}

type Runner

type Runner interface {
	// TODO files should be some io interface to falicitate testing
	// StartPlaybook runs the playbook asynchronously with the given inventory and extra vars.
	StartPlaybook(playbookFileName, inventory string, playbookOptions *PlaybookOptions) error
	// WaitPlaybook blocks until the execution of the playbook is complete. If an error occurred,
	// it is returned. Otherwise, returns nil to signal the completion of the playbook.
	WaitPlaybook() error
}

Runner for running Ansible playbooks.

func NewRunner

func NewRunner(runDir string, loggerConfig *LoggerConfig) Runner

NewRunner returns a new runner for running Ansible playbooks.

Jump to

Keyboard shortcuts

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