Documentation
¶
Index ¶
- func Generate(cfg *Config) (*UserData, *MetaData, *NetworkConfig)
- func InjectNoCloud(rootPath string, ud *UserData, md *MetaData, nc *NetworkConfig) error
- type BondConfig
- type BondParams
- type Config
- type EthConfig
- type MatchConfig
- type MetaData
- type NSConfig
- type NTPConfig
- type NetworkConfig
- type User
- type UserData
- type WriteFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Generate ¶
func Generate(cfg *Config) (*UserData, *MetaData, *NetworkConfig)
Generate creates cloud-init user-data, meta-data, and network-config.
func InjectNoCloud ¶
func InjectNoCloud(rootPath string, ud *UserData, md *MetaData, nc *NetworkConfig) error
InjectNoCloud writes cloud-init seed files to the NoCloud datasource directory.
Types ¶
type BondConfig ¶
type BondConfig struct {
Interfaces []string `yaml:"interfaces"`
Parameters *BondParams `yaml:"parameters,omitempty"`
Addresses []string `yaml:"addresses,omitempty"`
Gateway4 string `yaml:"gateway4,omitempty"`
Nameservers *NSConfig `yaml:"nameservers,omitempty"`
DHCP4 bool `yaml:"dhcp4,omitempty"`
}
BondConfig represents a bond device configuration.
type BondParams ¶
type BondParams struct {
Mode string `yaml:"mode,omitempty"`
LACPRate string `yaml:"lacp-rate,omitempty"`
TransmitHashPolicy string `yaml:"transmit-hash-policy,omitempty"`
}
BondParams represents bond parameters.
type Config ¶
type Config struct {
Hostname string
FQDN string
InstanceID string
SSHKeys []string
Users []User
Packages []string
RunCommands [][]string
WriteFiles []WriteFile
NTP *NTPConfig
Timezone string
StaticIP string
Gateway string
DNS []string
BondIfaces []string
BondMode string
MACAddress string
}
Config holds the input configuration for cloud-init generation.
type EthConfig ¶
type EthConfig struct {
Match *MatchConfig `yaml:"match,omitempty"`
DHCP4 bool `yaml:"dhcp4,omitempty"`
Addresses []string `yaml:"addresses,omitempty"`
Gateway4 string `yaml:"gateway4,omitempty"`
Nameservers *NSConfig `yaml:"nameservers,omitempty"`
MTU int `yaml:"mtu,omitempty"`
}
EthConfig represents an ethernet device configuration.
type MatchConfig ¶
type MatchConfig struct {
MACAddress string `yaml:"macaddress,omitempty"`
Driver string `yaml:"driver,omitempty"`
}
MatchConfig matches network interfaces.
type MetaData ¶
type MetaData struct {
InstanceID string `yaml:"instance-id"`
LocalHostname string `yaml:"local-hostname"`
Platform string `yaml:"platform,omitempty"`
}
MetaData represents cloud-init meta-data.
type NSConfig ¶
type NSConfig struct {
Addresses []string `yaml:"addresses,omitempty"`
Search []string `yaml:"search,omitempty"`
}
NSConfig represents nameserver configuration.
type NTPConfig ¶
type NTPConfig struct {
Enabled bool `yaml:"enabled"`
Servers []string `yaml:"servers,omitempty"`
Pools []string `yaml:"pools,omitempty"`
}
NTPConfig represents cloud-init NTP configuration.
type NetworkConfig ¶
type NetworkConfig struct {
Version int `yaml:"version"`
Ethernets map[string]EthConfig `yaml:"ethernets,omitempty"`
Bonds map[string]BondConfig `yaml:"bonds,omitempty"`
}
NetworkConfig represents cloud-init network-config v2.
func (*NetworkConfig) Render ¶
func (n *NetworkConfig) Render() ([]byte, error)
Render serializes NetworkConfig to YAML.
type User ¶
type User struct {
Name string `yaml:"name"`
Groups string `yaml:"groups,omitempty"`
Shell string `yaml:"shell,omitempty"`
Sudo string `yaml:"sudo,omitempty"`
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys,omitempty"`
LockPasswd *bool `yaml:"lock_passwd,omitempty"`
}
User represents a cloud-init user entry.
type UserData ¶
type UserData struct {
Hostname string `yaml:"hostname,omitempty"`
FQDN string `yaml:"fqdn,omitempty"`
ManageEtcHosts bool `yaml:"manage_etc_hosts,omitempty"`
Users []User `yaml:"users,omitempty"`
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys,omitempty"`
Packages []string `yaml:"packages,omitempty"`
PackageUpdate bool `yaml:"package_update,omitempty"`
RunCmd [][]string `yaml:"runcmd,omitempty"`
WriteFiles []WriteFile `yaml:"write_files,omitempty"`
NTP *NTPConfig `yaml:"ntp,omitempty"`
Timezone string `yaml:"timezone,omitempty"`
}
UserData represents cloud-init user-data configuration.