Documentation
¶
Overview ¶
Package cloudinit provides utilities for generating cloud-init configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateMetadata ¶
GenerateMetadata generates cloud-init metadata YAML content for the given hostname.
func MarshalToYAML ¶
MarshalToYAML serializes the given cloud-init Config to YAML format.
func WriteDataFiles ¶
func WriteDataFiles( ctx opctx.Ctx, dir string, hostname string, config *Config, ) (metaDataPath, userDataPath string, err error)
WriteDataFiles writes the cloud-init meta-data and user-data files to the specified directory. Returns the paths to the created meta-data and user-data files.
Types ¶
type Config ¶
type Config struct {
ChangePasswords *PasswordConfig `yaml:"chpasswd,omitempty"`
EnableSSHPasswordAuth *bool `yaml:"ssh_pwauth,omitempty"`
DisableRootUser *bool `yaml:"disable_root,omitempty"`
Users []UserConfig `yaml:"users,omitempty"`
}
Config represents the cloud-init configuration. N.B. Minimal definition with what we're using.
type PasswordConfig ¶
type PasswordConfig struct {
List string `yaml:"list,omitempty"`
Expire *bool `yaml:"expire,omitempty"`
}
PasswordConfig contains password change configuration for cloud-init. N.B. Minimal definition with what we're using.
type UserConfig ¶
type UserConfig struct {
Description string `yaml:"gecos,omitempty"`
EnableSSHPasswordAuth *bool `yaml:"ssh_pwauth,omitempty"`
Groups []string `yaml:"groups,omitempty"`
LockPassword *bool `yaml:"lock_passwd,omitempty"`
Name string `yaml:"name,omitempty"`
PlainTextPassword string `yaml:"plain_text_passwd,omitempty"`
Shell string `yaml:"shell,omitempty"`
SSHAuthorizedKeys []string `yaml:"ssh_authorized_keys,omitempty"`
Sudo []string `yaml:"sudo,omitempty"`
}
UserConfig contains user configuration for cloud-init. N.B. Minimal definition with what we're using.