Documentation ¶
Overview ¶
Package ansible contains libraries for interacting with the Ansible IT automation tool.
Index ¶
- Constants
- func EventStream(in io.Reader) <-chan Event
- type Event
- type ExtraVars
- type HandlerTaskStartEvent
- type Inventory
- type Node
- type OutputFormat
- type PlayStartEvent
- type PlaybookEndEvent
- type PlaybookStartEvent
- type Role
- type Runner
- type RunnerFailedEvent
- type RunnerItemOKEvent
- type RunnerItemRetryEvent
- type RunnerOKEvent
- type RunnerSkippedEvent
- type RunnerUnreachableEvent
- type TaskStartEvent
Constants ¶
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 ¶
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 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 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
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 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