Last active
March 4, 2020 09:43
-
-
Save unakatsuo/411f7ca3e31ed1cf8c66dbbdcb9d5da3 to your computer and use it in GitHub Desktop.
Packer template for Ubuntu 18.04 cloud image + VirutualBox.
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
local-hostname: ubuntu1 |
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
{ | |
"variables": { | |
"memory": "2048" | |
}, | |
"builders": [ | |
{ | |
"type": "virtualbox-ovf", | |
"keep_registered": true, | |
"skip_export": true, | |
"source_path": "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.ova", | |
"ssh_username": "ubuntu", | |
"ssh_password": "passw0rd", | |
"communicator": "ssh", | |
"shutdown_command": "echo 'ubuntu' | sudo -S /sbin/halt -h -p", | |
"shutdown_timeout": "10m", | |
"headless": false, | |
"vm_name": "ubuntu1", | |
"pause_before_connecting": "50s", | |
"http_directory": ".", | |
"vboxmanage": [ | |
[ | |
"modifyvm", | |
"{{.Name}}", | |
"--memory", | |
"{{ user `memory` }}" | |
], | |
[ | |
"modifyvm", | |
"{{ .Name }}", | |
"--nictype1", | |
"virtio" | |
], | |
[ | |
"setextradata", | |
"{{ .Name }}", | |
"VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial", | |
"string:ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/" | |
], | |
[ | |
"modifyvm", | |
"{{ .Name }}", | |
"--uart1", | |
"0x3F8", "4" | |
], | |
[ | |
"modifyvm", | |
"{{ .Name }}", | |
"--uartmode1", | |
"file", | |
"{{ pwd }}/console.log" | |
] | |
], | |
"vboxmanage_post": [ | |
[ | |
"modifyvm", | |
"{{ .Name }}", | |
"--description", | |
"Ubuntu 18.04, {{ .Name }}" | |
] | |
] | |
} | |
] | |
} |
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
#cloud-config | |
password: passw0rd | |
chpasswd: { expire: False } | |
ssh_pwauth: True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment