results

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 10 Imported by: 29

Documentation

Index

Constants

View Source
const (
	// PrefixTokenSeparator is and string printed between prefix and ansible output
	PrefixTokenSeparator = "\u2500\u2500"

	// DefaultLogFormatLayout is the default format when is used the LogFormat transformer
	DefaultLogFormatLayout = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func DefaultStdoutCallbackResults

func DefaultStdoutCallbackResults(ctx context.Context, r io.Reader, w io.Writer, trans ...TransformerFunc) error

DefaultStdoutCallbackResults is the default method to print ansible-playbook results

func JSONStdoutCallbackResults

func JSONStdoutCallbackResults(ctx context.Context, r io.Reader, w io.Writer, transformers ...TransformerFunc) error

JSONStdoutCallbackResults method manges the ansible' JSON stdout callback and print the result stats

func Now

func Now(layout string) string

Now returns a time value according to layout

Types

type AnsiblePlaybookJSONResults

type AnsiblePlaybookJSONResults struct {
	Playbook          string                                      `json:"-"`
	CustomStats       interface{}                                 `json:"custom_stats"`
	GlobalCustomStats interface{}                                 `json:"global_custom_stats"`
	Plays             []AnsiblePlaybookJSONResultsPlay            `json:"plays"`
	Stats             map[string]*AnsiblePlaybookJSONResultsStats `json:"stats"`
}

AnsiblePlaybookJSONResults

func JSONParse

func JSONParse(data []byte) (*AnsiblePlaybookJSONResults, error)

JSONParse return an AnsiblePlaybookJSONResults from

func ParseJSONResultsStream added in v1.1.4

func ParseJSONResultsStream(stream io.Reader) (*AnsiblePlaybookJSONResults, error)

ParseJSONResultsStream parse the ansible' JSON stdout callback and return an AnsiblePlaybookJSONResults

func (*AnsiblePlaybookJSONResults) CheckStats

func (r *AnsiblePlaybookJSONResults) CheckStats() error

CheckStats return error when is found a failure or unreachable host

func (*AnsiblePlaybookJSONResults) String

func (r *AnsiblePlaybookJSONResults) String() string

type AnsiblePlaybookJSONResultsPlay

type AnsiblePlaybookJSONResultsPlay struct {
	Play  *AnsiblePlaybookJSONResultsPlaysPlay `json:"play"`
	Tasks []AnsiblePlaybookJSONResultsPlayTask `json:"tasks"`
}

AnsiblePlaybookJSONResultsPlay

type AnsiblePlaybookJSONResultsPlayDuration

type AnsiblePlaybookJSONResultsPlayDuration struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

AnsiblePlaybookJSONResultsPlayDuration

type AnsiblePlaybookJSONResultsPlayTask

type AnsiblePlaybookJSONResultsPlayTask struct {
	Task  *AnsiblePlaybookJSONResultsPlayTaskItem                 `json:"task"`
	Hosts map[string]*AnsiblePlaybookJSONResultsPlayTaskHostsItem `json:"hosts"`
}
AnsiblePlaybookJSONResultsPlayTask

'task': {
	'name': task.get_name(),
	'id': to_text(task._uuid),
	'duration': {
		'start': current_time()
	}
},

'hosts': {}

type AnsiblePlaybookJSONResultsPlayTaskHostsItem

type AnsiblePlaybookJSONResultsPlayTaskHostsItem struct {
	Action           string                 `json:"action"`
	Changed          bool                   `json:"changed"`
	Msg              interface{}            `json:"msg"`
	AnsibleFacts     map[string]interface{} `json:"ansible_facts"`
	Stdout           interface{}            `json:"stdout"`
	StdoutLines      []string               `json:"stdout_lines"`
	Stderr           interface{}            `json:"stderr"`
	StderrLines      []string               `json:"stderr_lines"`
	Cmd              interface{}            `json:"cmd"`
	Failed           bool                   `json:"failed"`
	FailedWhenResult bool                   `json:"failed_when_result"`
	Skipped          bool                   `json:"skipped"`
	SkipReason       string                 `json:"skip_reason"`
	Unreachable      bool                   `json:"unreachable"`
}

type AnsiblePlaybookJSONResultsPlayTaskItem

type AnsiblePlaybookJSONResultsPlayTaskItem struct {
	Name     string                                          `json:"name"`
	Id       string                                          `json:"id"`
	Duration *AnsiblePlaybookJSONResultsPlayTaskItemDuration `json:"duration"`
}

type AnsiblePlaybookJSONResultsPlayTaskItemDuration

type AnsiblePlaybookJSONResultsPlayTaskItemDuration struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type AnsiblePlaybookJSONResultsPlaysPlay

type AnsiblePlaybookJSONResultsPlaysPlay struct {
	Name     string                                  `json:"name"`
	Id       string                                  `json:"id"`
	Duration *AnsiblePlaybookJSONResultsPlayDuration `json:"duration"`
}

AnsiblePlaybookJSONResultsPlaysPlay

type AnsiblePlaybookJSONResultsStats

type AnsiblePlaybookJSONResultsStats struct {
	Changed     int `json:"changed"`
	Failures    int `json:"failures"`
	Ignored     int `json:"ignored"`
	Ok          int `json:"ok"`
	Rescued     int `json:"rescued"`
	Skipped     int `json:"skipped"`
	Unreachable int `json:"unreachable"`
}

AnsiblePlaybookJSONResultsStats

func (*AnsiblePlaybookJSONResultsStats) String

type TransformerFunc

type TransformerFunc func(string) string

TransformerFunc is used to enrich or update messages before to be printed out

func Append

func Append(expression string) TransformerFunc

Append is a transformer function that includes a suffix to a message expression

func IgnoreMessage

func IgnoreMessage(skipPatterns []string) TransformerFunc

IgnoreMessage is a transformer function that returns a blank string when the message match to any skipping pattern

func LogFormat

func LogFormat(layout string, f func(string) string) TransformerFunc

LogFormat is a transformer function that includes a time reference at the beginning of a message expression

func Prepend

func Prepend(expression string) TransformerFunc

Prepend is a transformer function that includes a prefix to a message expression

Jump to

Keyboard shortcuts

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