types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Hosts map[string]*Host
	Vars  map[string]interface{}
}

Group represents a group of hosts in the inventory

type Host

type Host struct {
	Name    string `json:"name"`
	Host    string `yaml:"host"`
	IsLocal bool
	Vars    map[string]interface{}
	Groups  map[string]string `yaml:"groups"`
	Config  interface{}       // SSH configuration or other host-specific config
}

Host represents a single host in the inventory

func (*Host) Prepare

func (h *Host) Prepare()

Prepare initializes the host's maps if they are nil

func (Host) String

func (h Host) String() string

String returns the host name as string representation

func (*Host) UnmarshalYAML

func (h *Host) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements custom YAML unmarshaling for Host to capture unknown fields into Vars

type Inventory

type Inventory struct {
	Hosts  map[string]*Host       `yaml:"all"`
	Vars   map[string]interface{} `yaml:"vars"`
	Groups map[string]*Group      `yaml:"-"` // Groups are parsed manually from top-level keys
	Plugin string                 `yaml:"plugin"`
}

Inventory represents the complete inventory structure

func (*Inventory) GetHostByName

func (i *Inventory) GetHostByName(name string) (*Host, error)

GetHostByName returns a host by name from the inventory

func (*Inventory) GetInitialFactsForHost

func (i *Inventory) GetInitialFactsForHost(host *Host) map[string]interface{}

GetInitialFactsForHost gathers and layers facts for a specific host from the inventory. It applies global inventory vars, then group vars, then host-specific vars.

func (*Inventory) UnmarshalYAML

func (inv *Inventory) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements custom YAML unmarshaling for Inventory to handle top-level groups

Jump to

Keyboard shortcuts

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