ansible

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Equal     = "=="
	NotEqual  = "!="
	EndWith   = "$="
	Contains  = "~="
	StartWith = "^="
)

Variables

View Source
var (
	AllowedOperators   = []string{Equal, NotEqual, StartWith, Contains, EndWith}
	FiltersRe          = regexp.MustCompile("(\\w*)(==|!=|$=|~=|^=)(\\w*)")
	FilterRegex        = regexp.MustCompile("(\\w*)(\\W*)(\\w*)")
	FilterCompletionRe = regexp.MustCompile("(\\w*)(==|!=|$=|~=|^=)(\\w*)([,]|)")
)
View Source
var AdHocCmdTemplate = `` /* 892-byte string literal not displayed */
View Source
var AnsibleValidRoleSubFolders = utils.NewSetFromSlice("tasks", "meta")
View Source
var Inventories = inventories{}
View Source
var PlaybookCmdTemplate = `` /* 551-byte string literal not displayed */
View Source
var Playbooks = playbooks{}
View Source
var Projects = projects{}

Functions

func ParseFilter

func ParseFilter(filter string) (key, op, value string)

Types

type AdHocCmd added in v0.3.0

type AdHocCmd struct {
	Comment           string
	Inventory         []*Inventory
	Pattern           string
	ModuleName        string
	ModuleArgs        string
	ExtraVars         map[string]interface{}
	Background        int
	Fork              int
	PollInterval      int
	Limit             []string
	Check             bool
	Diff              bool
	OneLine           bool
	Tree              bool
	PlaybookDir       string
	VaultPasswordFile string
	AskVaultPass      bool
}

func (*AdHocCmd) AddExtraVar added in v0.3.0

func (o *AdHocCmd) AddExtraVar(name string, value interface{}) error

func (*AdHocCmd) Generate added in v0.3.0

func (o *AdHocCmd) Generate()

type Filter

type Filter struct {
	Key   string
	Op    string
	Value string
}

func ParseFilterArgsFromSlice

func ParseFilterArgsFromSlice(rawFilters []string) (filters []Filter)

func ParseFilterArgsFromString

func ParseFilterArgsFromString(raw string) (filters []Filter)

func (Filter) Eval

func (f Filter) Eval(against string) bool

func (Filter) GetRaw

func (f Filter) GetRaw() string

type Filters

type Filters []Filter

type Inventory

type Inventory struct {
	AbsolutePath string
	RootPath     *string
	PathTags     []string
	Data         *aini.InventoryData
}

func (*Inventory) RelativePath

func (i *Inventory) RelativePath() string

type Play

type Play struct {
	Hosts string    `yaml:"hosts"`
	Roles []*Role   `yaml:"roles"`
	Tags  utils.Set `yaml:"tags"`
}

func (*Play) AllTags

func (play *Play) AllTags() (tags *utils.Set)

type Playbook

type Playbook struct {
	Plays []*Play
	// contains filtered or unexported fields
}

func (*Playbook) AllTags

func (playbook *Playbook) AllTags() (tags *utils.Set)

func (*Playbook) RelativePath

func (playbook *Playbook) RelativePath() string

type PlaybookCmd added in v0.3.0

type PlaybookCmd struct {
	Comment           string
	Inventory         []*Inventory
	Playbook          *Playbook
	Tags              []string
	Limit             []string
	SkipTags          []string
	Check             bool
	Diff              bool
	VaultPasswordFile string
	AskVaultPass      bool
}

func (*PlaybookCmd) Generate added in v0.3.0

func (tpl *PlaybookCmd) Generate()

type Project

type Project struct {
	Path        *string
	Inventories []*Inventory
	Playbooks   []*Playbook
}

func (Project) FilterInventory

func (p Project) FilterInventory(filters []Filter) (filtered []*Inventory)

Returns inventory that match all the conditions

func (Project) InventoryGroups added in v0.3.0

func (p Project) InventoryGroups() (values []string)

func (Project) InventoryHost added in v0.3.0

func (p Project) InventoryHost() (values []string)

func (Project) InventoryKeys

func (p Project) InventoryKeys() (keys []string)

Returns variables name contained in the all section of all inventory files

func (Project) InventoryValues

func (p Project) InventoryValues(key string) (values []string)

Given a variable name returns value across multiples inventory files

func (Project) PlaybookPath

func (p Project) PlaybookPath(path string) (playbook *Playbook, err error)

func (Project) PlaybookPaths

func (p Project) PlaybookPaths() (values []string)

type Role

type Role struct {
	AbsolutePath string
	Name         string    `yaml:"role"`
	Tasks        []Task    `yaml:"tasks"`
	Tags         utils.Set `yaml:"tags"`
}

func (*Role) AllTags

func (role *Role) AllTags() *utils.Set

func (*Role) LoadFromPath

func (role *Role) LoadFromPath(rootPath string) (err error)

LoadFromPath Gather inventory files LoadFromPath a Parent directory Using a recursive scan. All non inventory files are ignored ( not .ini file ) All sub parent directory added like label in the inventory

type Task

type Task struct {
	Name string `yaml:"name,omitempty"`
	Tags utils.Set
}

Jump to

Keyboard shortcuts

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