Documentation
¶
Index ¶
- func MergeYAMLs(yamls ...[]byte) (string, error)
- type Metadata
- type NetworkInterfaceParameters
- type Networkconfig
- type Networkdata
- type NetworkdataInner
- type SSHKeys
- type Subnetconfig
- type Userdata
- func (ud *Userdata) AddRunCommand(cmd []string)
- func (ud *Userdata) AddUser(name, gecos, passwd string, groups, ssh_authorized_keys []string, ...)
- func (ud *Userdata) AddWriteFile(encoding, content, owner, path, permissions string)
- func (u *Userdata) RenderYAML(path string, vendor_data string) error
- type Vendordata
- type WriteFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Metadata ¶
type Metadata struct {
InstanceID string `yaml:"instance-id,omitempty"`
Hostname string `yaml:"local-hostname,omitempty"`
NetworkInterfaces string `yaml:"network-interfaces,omitempty"`
}
Metadata Network data is applied to metadata for Cloudbase-Init
https://cloudbase-init.readthedocs.io/en/latest/services.html#nocloud-configuration-drive
func (*Metadata) AddNetworkInterfaces ¶
func (m *Metadata) AddNetworkInterfaces(param NetworkInterfaceParameters)
type NetworkInterfaceParameters ¶
type NetworkInterfaceParameters struct {
InterfaceName string
InterfaceType string
Address string
Address6 string
Netmask string
Netmask6 string
Gateway string
Gateway6 string
MacAddress string
DnsNameservers string
}
Metadata Network Interface
Example:
network-interfaces: |
iface Ethernet0 inet static address 10.0.0.2 netmask 255.255.255.0 gateway 10.0.0.1 hwaddress ether 00:11:22:33:44:55
type Networkconfig ¶
type Networkconfig struct {
Type string `yaml:"type,omitempty"` //physical
Name string `yaml:"name,omitempty"` //interface0
MacAddress string `yaml:"mac_address,omitempty"`
Subnets []Subnetconfig `yaml:"subnets,omitempty"`
}
func CreateNetworkConfiguration ¶
func CreateNetworkConfiguration(interfaceName string) Networkconfig
CreateNetworkConfiguration
func (*Networkconfig) AddMacAddress ¶
func (nc *Networkconfig) AddMacAddress(macaddress string)
AddMacAddress
func (*Networkconfig) AddStaticSubnet ¶
func (nc *Networkconfig) AddStaticSubnet(ipaddress, gatewayv4 string, dnsNameserversv4, dnsSearch []string)
AddStaticSubnet
type Networkdata ¶
type Networkdata struct {
Network NetworkdataInner `yaml:"network,omitempty"`
}
func (*Networkdata) AddNetworkConfiguration ¶
func (n *Networkdata) AddNetworkConfiguration(config Networkconfig)
AddNetworkConfiguration
type NetworkdataInner ¶
type NetworkdataInner struct {
Version int `yaml:"version,omitempty"`
Config []Networkconfig `yaml:"config,omitempty"`
}
type SSHKeys ¶
type SSHKeys struct {
RSAPrivateKey string `yaml:"rsa_private,omitempty"`
RSAPublicKey string `yaml:"rsa_public,omitempty"`
DSAPrivateKey string `yaml:"dsa_private,omitempty"`
DSAPublicKey string `yaml:"dsa_public,omitempty"`
}
func CreateSSHKeys ¶
type Subnetconfig ¶
type Subnetconfig struct {
Type string `yaml:"type,omitempty"` //dhcp, static
Address string `yaml:"address,omitempty"` //ipv4 or ipv6 (may include CIDR)
Gateway4 string `yaml:"gateway,omitempty"` //ipv4 gateway
DnsNameservers4 []string `yaml:"dns_nameservers,omitempty"` // ip4 dns server IPs to be included in resolv.conf
DnsSearch []string `yaml:"dns_search,omitempty"` // search paths to be included in resolv.conf
}
type Userdata ¶
type Userdata struct {
Hostname string `yaml:"hostname,omitempty"`
ResizeRootFS bool `yaml:"resize_rootfs,omitempty"`
Users []*user `yaml:"users,omitempty"`
SSHPasswordAuthentication bool `yaml:"ssh_pwauth,omitempty"`
WriteFiles []*WriteFile `yaml:"write_files,omitempty"`
RunCommands []string `yaml:"runcmd,omitempty"`
FinalMessage string `yaml:"final_message,omitempty"`
}
Userdata
func (*Userdata) AddRunCommand ¶
func (*Userdata) AddUser ¶
func (ud *Userdata) AddUser(name, gecos, passwd string, groups, ssh_authorized_keys []string, keys *SSHKeys)
AddUser
func (*Userdata) AddWriteFile ¶
AddWriteFile
type Vendordata ¶
type Vendordata struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.