Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultGrouper ¶
type DefaultGrouper struct { // GroupMappings is a mapping of hosts, like group => host1, host2 ... GroupMappings map[string][]string }
DefaultGrouper is the default implementation of Grouper
func (*DefaultGrouper) GroupsForHost ¶
func (s *DefaultGrouper) GroupsForHost(hostname string) (groupNames []string)
GroupsForHost will return any groups that the host is a part of
func (*DefaultGrouper) LoadYaml ¶
func (s *DefaultGrouper) LoadYaml(fileName string)
LoadYaml loads a YAML file and tries to Unmarshal it into the GroupMappings type
type GroupDefinition ¶
type GroupDefinition struct { Hosts []string `json:"hosts"` Vars map[string]interface{} `json:"vars,omitempty"` Children []string `json:"children,omitempty"` }
GroupDefinition is used to define a group of hosts
type Grouper ¶
type Grouper interface { // GroupsForHost should return any groups that the host is a part of GroupsForHost(hostname string) (groupNames []string) }
Grouper is an interface for the grouping of hosts
type HostVars ¶
type HostVars struct { IP string `json:"ansible_host"` DNS string `json:"hcloud_dns"` Location string `json:"hcloud_location"` Datacenter string `json:"hcloud_datacenter"` Image string `json:"hcloud_image"` }
HostVars is host specific variables to be stored in meta
type Inventory ¶
type Inventory struct {
// contains filtered or unexported fields
}
Inventory is the main struct which will be returned as a result of GetInventoryFromAPI
func GetInventoryFromAPI ¶
func GetInventoryFromAPI(client ServerClient, grouper Grouper) *Inventory
GetInventoryFromAPI returns a JSON-formatted and Ansible-compatible representation of all virtual servers that are listed under the specified Hetzner Cloud API account.
func (*Inventory) Group ¶
func (s *Inventory) Group(name string) *GroupDefinition
Group is used for getting and/or creating a group for storing hosts
func (*Inventory) UpdateAllGroup ¶
func (s *Inventory) UpdateAllGroup()
UpdateAllGroup will refresh the Inventory group named all