-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate cloud-config outside of cidata.iso too
This does not include any mounts, networks, nor boot scripts. It is assumed that "reverse-sshfs" is being used, for mounts. It also does not include lima-guestagent, nerdctl-full.tgz, or any of the provisioning scripts that are in the cidata... Signed-off-by: Anders F Björklund <[email protected]>
- Loading branch information
1 parent
8584007
commit 17ec2bd
Showing
8 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#cloud-config | ||
# vim:syntax=yaml | ||
|
||
growpart: | ||
mode: auto | ||
devices: ['/'] | ||
|
||
{{- if .UpgradePackages }} | ||
package_update: true | ||
package_upgrade: true | ||
package_reboot_if_required: true | ||
{{- end }} | ||
|
||
{{- if or (eq .MountType "9p") (eq .MountType "virtiofs") }} | ||
{{- if .Mounts }} | ||
# mounts are not included here | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- if .TimeZone }} | ||
timezone: {{.TimeZone}} | ||
{{- end }} | ||
|
||
users: | ||
- name: "{{.User}}" | ||
uid: "{{.UID}}" | ||
homedir: "{{.Home}}" | ||
shell: /bin/bash | ||
sudo: ALL=(ALL) NOPASSWD:ALL | ||
lock_passwd: true | ||
ssh-authorized-keys: | ||
{{- range $val := .SSHPubKeys }} | ||
- {{ printf "%q" $val }} | ||
{{- end }} | ||
|
||
{{- if .DNSAddresses }} | ||
# resolv_conf is not included here | ||
{{- end }} | ||
|
||
{{ with .CACerts }} | ||
ca_certs: | ||
remove_defaults: {{ .RemoveDefaults }} | ||
{{- if .Trusted}} | ||
trusted: | ||
{{- range $cert := .Trusted }} | ||
- | | ||
{{- range $line := $cert.Lines }} | ||
{{ $line }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- if .BootCmds }} | ||
bootcmd: | ||
{{- range $cmd := $.BootCmds }} | ||
- | | ||
{{- range $line := $cmd.Lines }} | ||
{{ $line }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,25 @@ import ( | |
|
||
var defaultRemoveDefaults = false | ||
|
||
func TestConfig(t *testing.T) { | ||
args := &TemplateArgs{ | ||
Name: "default", | ||
User: "foo", | ||
UID: 501, | ||
Home: "/home/foo.linux", | ||
SSHPubKeys: []string{ | ||
"ssh-rsa dummy [email protected]", | ||
}, | ||
MountType: "reverse-sshfs", | ||
CACerts: CACerts{ | ||
RemoveDefaults: &defaultRemoveDefaults, | ||
}, | ||
} | ||
config, err := ExpandTemplate(args) | ||
assert.NilError(t, err) | ||
t.Log(string(config)) | ||
} | ||
|
||
func TestTemplate(t *testing.T) { | ||
args := &TemplateArgs{ | ||
Name: "default", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters