ansible

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2017 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Overview

Package ansible contains libraries for interacting with the Ansible IT automation tool.

Index

Constants

View Source
const (
	// RawFormat is the raw Ansible output formatting
	RawFormat = OutputFormat("raw")
	// JSONLinesFormat is a JSON Lines representation of Ansible events
	JSONLinesFormat = OutputFormat("json_lines")
)

Variables

This section is empty.

Functions

func EventStream

func EventStream(in io.Reader) <-chan Event

EventStream reads JSON lines from the incoming stream, and convert them into a stream of events.

Types

type Event

type Event interface {
	// Type is the name of the event type
	Type() string
}

Event produced by Ansible when running a playbook

type ExtraVars

type ExtraVars map[string]string

ExtraVars is a map of variables that are used when executing a playbook

type HandlerTaskStartEvent

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

HandlerTaskStartEvent signals the beginning of a handler task

func (*HandlerTaskStartEvent) Type

func (e *HandlerTaskStartEvent) Type() string

type Inventory

type Inventory []Role

Inventory is a collection of Nodes, keyed by role.

func (Inventory) ToINI

func (i Inventory) ToINI() []byte

ToINI converts the inventory into INI format

type Node

type Node struct {
	// Host is the hostname of the target node
	Host string
	// PublicIP is the publicly accessible IP
	PublicIP string
	// InternalIP is the internal IP, if different from PublicIP.
	InternalIP string
	// SSHPrivateKey is the private key to be used for SSH authentication
	SSHPrivateKey string
	// SSHPort is the SSH port number for connecting to the node
	SSHPort int
	// SSHUser is the SSH user for logging into the node
	SSHUser string
}

Node is an Ansible target node

type OutputFormat

type OutputFormat string

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

type PlayStartEvent

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

PlayStartEvent signals the beginning of a play

func (*PlayStartEvent) Type

func (e *PlayStartEvent) Type() string

type PlaybookEndEvent

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

PlaybookEndEvent signals the beginning of a playbook

func (*PlaybookEndEvent) Type

func (e *PlaybookEndEvent) Type() string

type PlaybookStartEvent

type PlaybookStartEvent struct {
	Count int
	// contains filtered or unexported fields
}

PlaybookStartEvent signals the beginning of a playbook

func (*PlaybookStartEvent) Type

func (e *PlaybookStartEvent) Type() string

type Role

type Role struct {
	// Name of the role
	Name string
	// The nodes that belong to this role
	Nodes []Node
}

Role is an Ansible role, containing nodes that belong to the role.

type Runner

type Runner interface {
	// StartPlaybook runs the playbook asynchronously with the given inventory and extra vars.
	// It returns a read-only channel that must be consumed for the playbook execution to proceed.
	StartPlaybook(playbookFile string, inventory Inventory, vars ExtraVars) (<-chan Event, 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
	// StartPlaybookOnNode runs the playbook asynchronously with the given inventory and extra vars
	// against the specific node.
	// It returns a read-only channel that must be consumed for the playbook execution to proceed.
	StartPlaybookOnNode(playbookFile string, inventory Inventory, vars ExtraVars, node string) (<-chan Event, error)
}

Runner for running Ansible playbooks

func NewRunner

func NewRunner(out, errOut io.Writer, ansibleDir string) (Runner, error)

NewRunner returns a new runner for running Ansible playbooks.

type RunnerFailedEvent

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

RunnerFailedEvent signals a failure when executing a runner

func (*RunnerFailedEvent) Type

func (e *RunnerFailedEvent) Type() string

type RunnerItemFailedEvent added in v1.1.1

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

RunnerItemFailedEvent signals the failure of a task with a specific item

func (*RunnerItemFailedEvent) Type added in v1.1.1

func (e *RunnerItemFailedEvent) Type() string

type RunnerItemOKEvent

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

RunnerItemOKEvent signals the successful completion of a runner item

func (*RunnerItemOKEvent) Type

func (e *RunnerItemOKEvent) Type() string

type RunnerItemRetryEvent

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

RunnerItemRetryEvent signals the retry of a runner item

func (*RunnerItemRetryEvent) Type

func (e *RunnerItemRetryEvent) Type() string

type RunnerOKEvent

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

RunnerOKEvent signals the successful completion of a runner

func (*RunnerOKEvent) Type

func (e *RunnerOKEvent) Type() string

type RunnerSkippedEvent

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

RunnerSkippedEvent is raised when a runner is skipped

func (*RunnerSkippedEvent) Type

func (e *RunnerSkippedEvent) Type() string

type RunnerUnreachableEvent

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

RunnerUnreachableEvent is raised when the target host is not reachable via SSH

func (*RunnerUnreachableEvent) Type

func (e *RunnerUnreachableEvent) Type() string

type TaskStartEvent

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

TaskStartEvent signals the beginning of a task

func (*TaskStartEvent) Type

func (e *TaskStartEvent) Type() string

Jump to

Keyboard shortcuts

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