Merge pull request #32 from liath/more-reliable-cloud-init

More reliable cloud-init startup
This commit is contained in:
Dom Del Nano 2021-12-18 17:13:17 -08:00 committed by GitHub
commit 5525b73b73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 6 deletions

View File

@ -191,6 +191,7 @@ func (self *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (p
}, },
&commonsteps.StepCreateFloppy{ &commonsteps.StepCreateFloppy{
Files: self.config.FloppyFiles, Files: self.config.FloppyFiles,
Label: "cidata",
}, },
&xscommon.StepHTTPServer{ &xscommon.StepHTTPServer{
Chan: httpReqChan, Chan: httpReqChan,

View File

@ -1,4 +1,13 @@
#cloud-config #cloud-config
# hack for cloud-init per:
# https://github.com/leakespeake/packer/blob/3f3e361751b4be9326b66771d96f2519bc8f885e/builders/vmware/vsphere-iso/ubuntu-server-20-04/hcl2/http/ubuntu-server-subiquity/user-data
runcmd:
# to enable true auto-install for Ubuntu 20.04 with cloud-init nocloud (eliminates "Continue with autoinstall?" prompt)
- [eval, 'echo $(cat /proc/cmdline) "autoinstall" > /root/cmdline']
- [eval, 'mount -n --bind -o ro /root/cmdline /proc/cmdline']
- [eval, 'snap restart subiquity.subiquity-service']
autoinstall: autoinstall:
version: 1 version: 1
identity: identity:
@ -6,6 +15,8 @@ autoinstall:
# This is the crypted pass of 'ubuntu' # This is the crypted pass of 'ubuntu'
password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
username: testuser username: testuser
packages:
- xe-guest-utilities
ssh: ssh:
install-server: yes install-server: yes
allow-pw: yes allow-pw: yes

View File

@ -65,12 +65,10 @@ source "xenserver-iso" "ubuntu-2004" {
vm_memory = 4096 vm_memory = 4096
disk_size = 20000 disk_size = 20000
http_directory = "examples/http/ubuntu-2004" floppy_files = [
boot_command = [ "examples/http/ubuntu-2004/meta-data",
"<esc><f6> autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/<enter><wait>", "examples/http/ubuntu-2004/user-data",
"<f6><wait><esc><wait> autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/<enter><wait>"
] ]
boot_wait = "10s"
ssh_username = "testuser" ssh_username = "testuser"
ssh_password = "ubuntu" ssh_password = "ubuntu"
@ -83,4 +81,4 @@ source "xenserver-iso" "ubuntu-2004" {
build { build {
sources = ["xenserver-iso.ubuntu-2004"] sources = ["xenserver-iso.ubuntu-2004"]
} }