Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { MetaData *MetaData UserData *UserData NetworkConfig *NetworkConfig }
Config represents all configurations for cloud init
func ConfigFromDir ¶
ConfigFromDir reads cloud-init configuration from directories. If multiple directories are passed, configurations of later directories overwrite configurations of previous directories
func NewDefaultConfig ¶
NewDefaultConfig returns a minimal default config based on name, user and ssh public key
func (*Config) Merge ¶
Merge merges configuration c2 into Config. Configurations in c2 overwrite configurations in Config.
type MetaData ¶
type MetaData struct { Raw map[string]any `json:"-"` Hostname string `json:"local-hostname,omitempty"` InstanceID string `json:"instnace-id,omitempty"` }
MetaData is a struct to render the meta data of the cloud init configuration
type NetworkConfig ¶
type NetworkConfig struct { Raw map[string]any `json:"-"` Version int `json:"version"` Ethernets map[string]Ethernet `json:"ethernets"` }
func NewNetworkConfig ¶
func NewNetworkConfig(nco NetworkConfigOptions) (*NetworkConfig, error)
func (*NetworkConfig) Marshal ¶
func (nc *NetworkConfig) Marshal() ([]byte, error)
func (*NetworkConfig) Merge ¶
func (nc *NetworkConfig) Merge(nc2 *NetworkConfig) error
func (*NetworkConfig) Unmarshal ¶
func (nc *NetworkConfig) Unmarshal(data []byte) error
type NetworkConfigOptions ¶
type User ¶
type User struct { Name string `json:"name"` SSHAuthorizedKeys []string `json:"ssh-authorized-keys,omitempty"` Sudo string `json:"sudo,omitempty"` LockPasswd *bool `json:"lock_passwd,omitempty"` Passwd string `json:"passwd,omitempty"` Shell string `json:"shell"` }
User definition of cloud init configuration
type UserData ¶
type UserData struct { Raw map[string]any `json:"-"` // Hostname string // Password string `yaml:"password,omitempty"` // SSHPasswordAuth bool `yaml:"ssh_pwauth,omitempty"` Users []User `json:"users,omitempty"` }
UserData is a struct to render the user data of the cloud init configuration
Click to show internal directories.
Click to hide internal directories.