Documentation
¶
Index ¶
- func InitEmbeddedModules()
- func ModuleGetCache(typ, name string) *fast.Interp
- func ModuleIsFact(name string) bool
- func ModuleIsTask(name string) bool
- func ModuleSetCache(typ, name string, interp *fast.Interp)
- func ModulesList(typ string) (out []string)
- func TaskV1FieldInfo(field *reflect.StructField) (info fieldInfo, err error)
- func TaskV1SetData(task_ptr any, fmap OrderedMap) error
- func ToYaml(obj any) (string, error)
- type OrderedMap
- func (om *OrderedMap) Data() map[string]any
- func (om *OrderedMap) Get(key string) (any, bool)
- func (om *OrderedMap) Keys() (keys []string)
- func (om *OrderedMap) MarshalYAML() (interface{}, error)
- func (om *OrderedMap) Pop(key string) (v any, ok bool)
- func (om *OrderedMap) Set(key string, value any)
- func (om *OrderedMap) Size() int
- func (om *OrderedMap) UnmarshalYAML(node *yaml.Node) error
- func (om *OrderedMap) Yaml() (string, error)
- type P_TaskV1Interface
- type Playbook
- type PlaybookFile
- type Role
- type TAny
- type TAnyList
- type TAnyMap
- type TBool
- type TBoolList
- type TBoolMap
- type TInt
- type TIntList
- type TIntMap
- type TString
- type TStringList
- type TStringMap
- type Task
- func (t *Task) IsRemote(vars map[string]any) bool
- func (t *Task) Load(yml_path string) error
- func (t *Task) MarshalYAML() (any, error)
- func (t *Task) Parse(data []byte) error
- func (t *Task) Run(vars map[string]any) (data OrderedMap, err error)
- func (t *Task) UnmarshalYAML(value *yaml.Node) (err error)
- func (t *Task) Yaml() (string, error)
- type TaskV1Default
- type TaskV1Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitEmbeddedModules ¶
func InitEmbeddedModules()
func ModuleGetCache ¶
func ModuleIsFact ¶
func ModuleSetCache ¶
func TaskV1FieldInfo ¶
func TaskV1FieldInfo(field *reflect.StructField) (info fieldInfo, err error)
Get information from the TaskV1 field tags, useful when processing semi-automatically
func TaskV1SetData ¶
func TaskV1SetData(task_ptr any, fmap OrderedMap) error
To set data into the typical task struct according to defined field tags
Types ¶
type OrderedMap ¶
type OrderedMap struct {
// contains filtered or unexported fields
}
func CollectV1 ¶
func CollectV1(name string) (out *OrderedMap, err error)
func TaskV1GetData ¶
func TaskV1GetData(task_ptr any) (fmap OrderedMap)
To get data from a typical task struct according to defined field tags It returns list of key-value pairs to preserve the order of fields
func (*OrderedMap) Data ¶
func (om *OrderedMap) Data() map[string]any
func (*OrderedMap) Keys ¶
func (om *OrderedMap) Keys() (keys []string)
func (*OrderedMap) MarshalYAML ¶
func (om *OrderedMap) MarshalYAML() (interface{}, error)
func (*OrderedMap) Set ¶
func (om *OrderedMap) Set(key string, value any)
func (*OrderedMap) Size ¶
func (om *OrderedMap) Size() int
func (*OrderedMap) UnmarshalYAML ¶
func (om *OrderedMap) UnmarshalYAML(node *yaml.Node) error
func (*OrderedMap) Yaml ¶
func (om *OrderedMap) Yaml() (string, error)
type P_TaskV1Interface ¶
type P_TaskV1Interface struct { Object any GetData_ func(_obj_ any) OrderedMap Run_ func(_obj_ any, vars map[string]any) (OrderedMap, error) SetData_ func(_obj_ any, data *OrderedMap) error }
Proxy is needed for interface conversion from script to be compiled WARNING: the order of func fields in proxy is ABC: https://github.com/cosmos72/gomacro/issues/128
func (*P_TaskV1Interface) GetData ¶
func (P *P_TaskV1Interface) GetData() OrderedMap
func (*P_TaskV1Interface) Run ¶
func (P *P_TaskV1Interface) Run(vars map[string]any) (OrderedMap, error)
func (*P_TaskV1Interface) SetData ¶
func (P *P_TaskV1Interface) SetData(data *OrderedMap) error
type Playbook ¶
type Playbook struct { Name string `yaml:",omitempty"` Gather_facts bool `default:"true" yaml:",omitempty"` Environment *OrderedMap `yaml:",omitempty"` Pre_tasks []*Task `yaml:",omitempty"` Tasks []*Task `yaml:",omitempty"` Roles []*Role `yaml:",omitempty"` Post_tasks []*Task `yaml:",omitempty"` }
func (*Playbook) UnmarshalYAML ¶
Allows to set defaults from struct definition
type PlaybookFile ¶
type PlaybookFile []Playbook
func (*PlaybookFile) Load ¶
func (pf *PlaybookFile) Load(yml_path string) error
func (*PlaybookFile) Parse ¶
func (pf *PlaybookFile) Parse(data []byte) error
func (*PlaybookFile) Yaml ¶
func (pf *PlaybookFile) Yaml() (string, error)
type Role ¶
type Role struct { Name string `yaml:"role"` Environment *OrderedMap `yaml:",omitempty"` Vars *OrderedMap `yaml:",omitempty"` }
type TAny ¶
type TAny struct {
// contains filtered or unexported fields
}
func (*TAny) MarshalYAML ¶
func (*TAny) SetTemplate ¶
func (*TAny) SetUnknown ¶
func (*TAny) UnmarshalYAML ¶
type TStringList ¶
type TStringList []TString
func (*TStringList) Val ¶
func (t *TStringList) Val() (out []string)
type TStringMap ¶
type Task ¶
type Task struct { // Identifier. Can be used for documentation, in or tasks/handlers. Name TString `yaml:",omitempty"` // A dictionary that gets converted into environment vars to be provided for the task upon execution. This cannot affect Ansible itself nor its configuration, it just sets the variables for the code responsible for executing the task. Environment *TStringMap `yaml:",omitempty"` // Conditional expression, determines if an iteration of a task is run or not. When TString `yaml:",omitempty"` // Only string right now, array looks confusing // Boolean that controls if privilege escalation is used or not on Task execution. Become TBool `yaml:",omitempty"` // Dictionary/map of variables specified in task Vars *TAnyMap `yaml:",omitempty"` // Name of variable that will contain task status and module return data. Register TString `yaml:",omitempty"` // Host to execute task instead of the target (inventory_hostname). Connection vars from the delegated host will also be used for the task. Delegate_to TString `yaml:",omitempty"` // Conditional expression that overrides the task’s normal ‘failed’ status. Failed_when TString `yaml:",omitempty"` // Loop through list of items With_items TStringList `yaml:",omitempty"` // Loop through dict key value With_dict *TAnyMap `yaml:",omitempty"` // TODO: Actually block could be potentally a task module, but for now in v1 it's just a // special case of task. Maybe in v2 it will be possible to pass yaml nodes to the tasks to // properly process subtasks of block, who knows... Block []*Task `yaml:",omitempty"` // Special case, contains list of tasks to execute // Found task module name ModuleName string `yaml:"-"` // Loaded implementation of the task module ModuleData TaskV1Interface `yaml:"-"` }
func (*Task) MarshalYAML ¶
func (*Task) UnmarshalYAML ¶
Determine what kind of the additional fields is here The function checks every key in yaml map and compare it to the available in structure. The unknown fields are checking on available task and if task found - it's good, if not - then keep search until it found.
type TaskV1Default ¶
type TaskV1Default struct {
Args OrderedMap // Various arguments for the particular task
}
TaskDefault is needed to represent a non-implemented task
func (*TaskV1Default) GetData ¶
func (t *TaskV1Default) GetData() OrderedMap
func (*TaskV1Default) SetData ¶
func (t *TaskV1Default) SetData(data *OrderedMap) error
type TaskV1Interface ¶
type TaskV1Interface interface { Run(vars map[string]any) (OrderedMap, error) SetData(data *OrderedMap) error GetData() OrderedMap }
func GetTaskV1 ¶
func GetTaskV1(name string) (out TaskV1Interface, err error)