Skip to content

Instantly share code, notes, and snippets.

@dan3sh
Last active October 8, 2018 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dan3sh/0ed70d17adfca341fd6296e1650e66bb to your computer and use it in GitHub Desktop.
Save dan3sh/0ed70d17adfca341fd6296e1650e66bb to your computer and use it in GitHub Desktop.
base ubuntu packer image for blog
{
"variables": {
"vm_name": "bloggy-base"
},
"builders": [
{
"type": "virtualbox-iso",
"boot_command": [
"<esc><wait>",
"<esc><wait>",
"<enter><wait>",
"/install/vmlinuz<wait>",
" auto",
" console-setup/ask_detect=false",
" console-setup/layoutcode=us",
" console-setup/modelcode=pc105",
" debconf/frontend=noninteractive",
" debian-installer=en_US",
" fb=false",
" initrd=/install/initrd.gz",
" kbd-chooser/method=us",
" keyboard-configuration/layout=USA",
" keyboard-configuration/variant=USA",
" locale=en_US",
" netcfg/get_domain=vm",
" netcfg/get_hostname=bloggard",
" grub-installer/bootdev=/dev/sda",
" noapic",
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",
" -- <wait>",
"<enter><wait>"
],
"boot_wait": "4s",
"disk_size": 81920,
"guest_os_type": "Ubuntu_64",
"headless": true,
"http_directory": "http",
"iso_urls": [
"packer_cache/ubuntu-18.04.1-server-amd64.iso",
"http://cdimage.ubuntu.com/releases/bionic/release/ubuntu-18.04.1-server-amd64.iso"
],
"iso_checksum_type": "sha256",
"iso_checksum": "a5b0ea5918f850124f3d72ef4b85bda82f0fcd02ec721be19c1a6952791c8ee8",
"ssh_username": "bloggard",
"ssh_password": "<no-no, get your own>",
"ssh_port": 22,
"ssh_wait_timeout": "10000s",
"shutdown_command": "echo 'bloggard'|sudo -S shutdown -P now",
"virtualbox_version_file": ".vbox_version",
"output_directory": "vms/",
"vm_name": "{{ user `vm_name` }}",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
]
}
],
"provisioners": [
{
"type": "file",
"source": ".keys/bloggard.pub",
"destination": "/tmp/bloggard.pub"
},
{
"type": "shell",
"script": "scripts/setup.sh",
"execute_command": "echo 'bloggard' | {{.Vars}} sudo -S -E bash '{{.Path}}'"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment