{ "variables": { "user": "vagrant", "password": "vagrant" }, "provisioners": [ { "type": "shell", "inline": [ "install -m0700 -o {{user `user`}} -g {{user `user`}} -d /home/{{user `user`}}/.ssh", "curl -SsL https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -o /home/{{user `user`}}/.ssh/authorized_keys" ] }, { "type": "shell", "execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'", "inline": [ "mount -o loop ${HOME}/VBoxGuestAdditions.iso /mnt", "/mnt/VBoxLinuxAdditions.run install", "ln -sf /usr/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf", "umount /mnt", "rm ${HOME}/VBoxGuestAdditions.iso" ] }, { "type": "ansible", "playbook_file": "ansible/playbook.yml", "extra_arguments": [ "--extra-vars", "mastodon_db_password=CHANGEME" ], "ansible_env_vars": [ "ANSIBLE_REMOTE_TEMP=\"~/.ansible-tmp\"", "ANSIBLE_SSH_PIPELINING=True" ] }, { "type": "shell", "execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'", "script": "scripts/clean.sh" }, { "type": "shell", "execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'", "script": "scripts/minimize.sh" } ], "builders": [ { "type": "virtualbox-iso", "boot_command": [ "", "", "", "", "/install/vmlinuz ", " auto ", " console-setup/ask_detect=false ", " console-setup/layoutcode=us ", " console-setup/modelcode=pc105 ", " debconf/frontend=noninteractive ", " debian-installer=en_US.UTF-8 ", " fb=false ", " initrd=/install/initrd.gz ", " kbd-chooser/method=us ", " keyboard-configuration/layout=USA ", " keyboard-configuration/variant=USA ", " locale=en_US.UTF-8 ", " netcfg/get_domain=vm ", " netcfg/get_hostname=vagrant ", " grub-installer/bootdev=/dev/sda ", " noapic ", " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg", " -- ", "" ], "boot_wait": "10s", "disk_size": 10000, "guest_os_type": "Ubuntu_64", "headless": true, "http_directory": "preseeds", "iso_urls": "http://releases.ubuntu.com/16.04/ubuntu-16.04.3-server-amd64.iso", "iso_checksum_type": "sha256", "iso_checksum": "a06cd926f5855d4f21fb4bc9978a35312f815fbda0d0ef7fdc846861f4fc4600", "ssh_username": "{{user `user`}}", "ssh_password": "{{user `user`}}", "ssh_wait_timeout": "20m", "shutdown_command": "echo 'vagrant'|sudo -S shutdown -P now", "vm_name": "packer-ubuntu-16.04-amd64", "vboxmanage": [ [ "modifyvm", "{{.Name}}", "--memory", "1024" ], [ "modifyvm", "{{.Name}}", "--cpus", "1" ] ] } ], "post-processors": [ { "output": "builds/{{.Provider}}-mastodon-ubuntu1604.box", "type": "vagrant" } ] }