v1

package
v0.0.0-...-0536e8a Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// AlwaysTag it always run
	AlwaysTag = "always"
	// NeverTag it never run
	NeverTag = "never"
	// AllTag represent all tags
	AllTag = "all"
	// TaggedTag represent which has tags
	TaggedTag = "tagged"
)

the special tags

Variables

This section is empty.

Functions

func IsTmplSyntax

func IsTmplSyntax(s string) bool

IsTmplSyntax Check if the string conforms to the template syntax.

func ParseTmplSyntax

func ParseTmplSyntax(s string) string

ParseTmplSyntax wraps a string with template syntax delimiters "{{" and "}}" to make it a valid Go template expression

func TrimTmplSyntax

func TrimTmplSyntax(s string) string

Types

type Base

type Base struct {
	Name string `yaml:"name,omitempty"`

	// connection/transport
	Connection string `yaml:"connection,omitempty"`
	Port       int    `yaml:"port,omitempty"`
	RemoteUser string `yaml:"remote_user,omitempty"`

	// variables
	Vars Vars `yaml:"vars,omitempty"`

	// flags and misc. settings
	Environment    []map[string]string `yaml:"environment,omitempty"`
	NoLog          bool                `yaml:"no_log,omitempty"`
	RunOnce        bool                `yaml:"run_once,omitempty"`
	IgnoreErrors   *bool               `yaml:"ignore_errors,omitempty"`
	CheckMode      bool                `yaml:"check_mode,omitempty"`
	Diff           bool                `yaml:"diff,omitempty"`
	AnyErrorsFatal bool                `yaml:"any_errors_fatal,omitempty"`
	Throttle       int                 `yaml:"throttle,omitempty"`
	Timeout        int                 `yaml:"timeout,omitempty"`

	// Debugger invoke a debugger on tasks
	Debugger string `yaml:"debugger,omitempty"`

	// privilege escalation
	Become       bool   `yaml:"become,omitempty"`
	BecomeMethod string `yaml:"become_method,omitempty"`
	BecomeUser   string `yaml:"become_user,omitempty"`
	BecomeFlags  string `yaml:"become_flags,omitempty"`
	BecomeExe    string `yaml:"become_exe,omitempty"`
}

Base defined in project.

type Block

type Block struct {
	BlockBase
	// If it has Block, Task should be empty
	Task
	IncludeTasks string `yaml:"include_tasks,omitempty"`

	BlockInfo
}

Block defined in project.

func (*Block) UnmarshalYAML

func (b *Block) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML yaml to block.

type BlockBase

type BlockBase struct {
	Base             `yaml:",inline"`
	Conditional      `yaml:",inline"`
	CollectionSearch `yaml:",inline"`
	Taggable         `yaml:",inline"`
	Notifiable       `yaml:",inline"`
	Delegable        `yaml:",inline"`
}

BlockBase defined in project.

type BlockInfo

type BlockInfo struct {
	Block  []Block `yaml:"block,omitempty"`
	Rescue []Block `yaml:"rescue,omitempty"`
	Always []Block `yaml:"always,omitempty"`
}

BlockInfo defined in project.

type CollectionSearch

type CollectionSearch struct {
	Collections []string `yaml:"collections,omitempty"`
}

CollectionSearch defined in project.

type Conditional

type Conditional struct {
	When When `yaml:"when,omitempty"`
}

Conditional defined in project.

type Delegable

type Delegable struct {
	DelegateTo    string `yaml:"delegate_to,omitempty"`
	DelegateFacts bool   `yaml:"delegate_facts,omitempty"`
}

Delegable defined in project.

type Handler

type Handler struct {
	Listen []string `yaml:"listen,omitempty"`
}

Handler defined in project.

type LoopControl

type LoopControl struct {
	LoopVar          string  `yaml:"loop_var,omitempty"`
	IndexVar         string  `yaml:"index_var,omitempty"`
	Label            string  `yaml:"label,omitempty"`
	Pause            float32 `yaml:"pause,omitempty"`
	Extended         bool    `yaml:"extended,omitempty"`
	ExtendedAllitems bool    `yaml:"extended_allitems,omitempty"`
}

LoopControl defined in project.

type Notifiable

type Notifiable struct {
	Notify string `yaml:"notify,omitempty"`
}

Notifiable defined in project.

type Play

type Play struct {
	ImportPlaybook string `yaml:"import_playbook,omitempty"`

	Base             `yaml:",inline"`
	Taggable         `yaml:",inline"`
	CollectionSearch `yaml:",inline"`

	PlayHost PlayHost `yaml:"hosts,omitempty"`

	// Facts
	GatherFacts bool `yaml:"gather_facts,omitempty"`

	// Variable Attribute
	VarsFiles []string `yaml:"vars_files,omitempty"`

	// Role Attributes
	Roles []Role `yaml:"roles,omitempty"`

	// Block (Task) Lists Attributes
	Handlers  []Block `yaml:"handlers,omitempty"`
	PreTasks  []Block `yaml:"pre_tasks,omitempty"`
	PostTasks []Block `yaml:"post_tasks,omitempty"`
	Tasks     []Block `yaml:"tasks,omitempty"`

	// Flag/Setting Attributes
	ForceHandlers     bool       `yaml:"force_handlers,omitempty"`
	MaxFailPercentage float32    `yaml:"percent,omitempty"`
	Serial            PlaySerial `yaml:"serial,omitempty"`
	Strategy          string     `yaml:"strategy,omitempty"`
	Order             string     `yaml:"order,omitempty"`
}

Play defined in project.

type PlayHost

type PlayHost struct {
	Hosts []string
}

PlayHost defined in project.

func (*PlayHost) UnmarshalYAML

func (p *PlayHost) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML yaml string to play

type PlaySerial

type PlaySerial struct {
	Data []any
}

PlaySerial defined in project.

func (*PlaySerial) UnmarshalYAML

func (s *PlaySerial) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML yaml string to serial.

type Playbook

type Playbook struct {
	Play []Play
}

Playbook defined in project.

func (*Playbook) Validate

func (p *Playbook) Validate() error

Validate playbook. delete empty ImportPlaybook which has convert to play.

type Role

type Role struct {
	RoleInfo
}

Role defined in project.

func (*Role) UnmarshalYAML

func (r *Role) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML yaml string to role.

type RoleInfo

type RoleInfo struct {
	Base             `yaml:",inline"`
	Conditional      `yaml:",inline"`
	Taggable         `yaml:",inline"`
	CollectionSearch `yaml:",inline"`

	RoleDependency []Role `yaml:"dependencies,omitempty"`

	// Role ref in playbook
	Role string `yaml:"role,omitempty"`

	Block []Block
}

RoleInfo defined in project.

type Taggable

type Taggable struct {
	Tags []string `yaml:"tags,omitempty"`
}

Taggable if it should executor

func JoinTag

func JoinTag(child, parent Taggable) Taggable

JoinTag the child block should inherit tag for parent block

func (Taggable) IsEnabled

func (t Taggable) IsEnabled(onlyTags []string, skipTags []string) bool

IsEnabled check if the block should be executed

type Task

type Task struct {
	AsyncVal    int         `yaml:"async,omitempty"`
	ChangedWhen When        `yaml:"changed_when,omitempty"`
	Delay       int         `yaml:"delay,omitempty"`
	FailedWhen  When        `yaml:"failed_when,omitempty"`
	Loop        any         `yaml:"loop,omitempty"`
	LoopControl LoopControl `yaml:"loop_control,omitempty"`
	Poll        int         `yaml:"poll,omitempty"`
	Register    string      `yaml:"register,omitempty"`
	// RegisterType how to register value to variable. support: string(default), json, yaml.
	RegisterType string `yaml:"register_type,omitempty"`
	Retries      int    `yaml:"retries,omitempty"`
	Until        When   `yaml:"until,omitempty"`

	// UnknownField store undefined field
	UnknownField map[string]any `yaml:"-"`
}

Task defined in project.

type Vars

type Vars struct {
	Nodes []yaml.Node
}

Vars is a custom type to hold a list of YAML nodes representing variables. This allows for flexible unmarshalling of various YAML structures into Vars.

func (*Vars) UnmarshalYAML

func (v *Vars) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Vars. It appends the unmarshalled YAML node to the Vars.Nodes slice.

type When

type When struct {
	Data []string
}

When defined in project.

func (*When) UnmarshalYAML

func (w *When) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML yaml string to when

Jump to

Keyboard shortcuts

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