123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- {
- "variables": {
- "user": "vagrant",
- "password": "vagrant"
- },
- "provisioners": [
- {
- "type": "shell",
- "inline": [
- "sudo apt-get update -qq",
- "sudo apt-get install -y git-core python-pip python-apt libffi-dev libssl-dev build-essential python-virtualenv python-setuptools",
- "mkdir -p /tmp/mastodon",
- "git clone https://github.com/tootsuite/mastodon-ansible /tmp/mastodon/ansible"
- ]
- },
- { "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",
- "umount /mnt",
- "rm ${HOME}/VBoxGuestAdditions.iso"
- ]
- },
- {
- "type": "shell",
- "inline": [
- "virtualenv venv",
- ". venv/bin/activate",
- "pip install --upgrade ansible==2.2.2.0"
- ]
- },
- {
- "type": "file",
- "source": "config/ansible.hosts",
- "destination": "/tmp/mastodon/ansible.hosts"
- },
- {
- "type": "shell",
- "environment_vars": ["ANSIBLE_REMOTE_TEMP=\"/tmp/mastodon/.ansible-tmp\"", "ANSIBLE_SSH_PIPELINING=True" ],
- "inline": [
- ". venv/bin/activate",
- "ansible-playbook -i /tmp/mastodon/ansible.hosts -v -b --extra-vars mastodon_db_password=CHANGEME /tmp/mastodon/ansible/bare/playbook.yml"
- ]
- },
- {
- "type": "shell",
- "execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'",
- "scripts": ["scripts/clean.sh", "scripts/minimize.sh"]
- }
- ],
- "builders": [
- {
- "type": "virtualbox-iso",
- "boot_command": [
- "<enter><wait><f6><esc><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
- "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
- "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
- "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
- "/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",
- " -- <wait>",
- "<enter><wait>"
- ],
- "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.4-server-amd64.iso",
- "iso_checksum_type": "sha256",
- "iso_checksum": "0a03608988cfd2e50567990dc8be96fb3c501e198e2e6efcb846d89efc7b89f2",
- "ssh_username": "{{user `user`}}",
- "ssh_password": "{{user `password`}}",
- "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"
- },
- {
- "type": "vagrant-cloud",
- "box_tag": "mastodon/ubuntu-xenial64",
- "version": "0.5.{{timestamp}}"
- }
- ]
- ],
- "push": {
- "name": "mastodon/ubuntu-xenial64",
- "vcs": true
- }
- }
|