From ba46cdb7e761564ec32344e80ba32cb8fd8bcfb0 Mon Sep 17 00:00:00 2001 From: Moritz Heiber Date: Tue, 23 May 2017 22:16:50 +0200 Subject: [PATCH] Try to work around some issues with the build --- .gitmodules | 2 +- ansible-playbook-workaround | 8 ----- config/ansible.hosts | 1 + packer.atlas.json | 58 +++++++++++++++++-------------------- 4 files changed, 29 insertions(+), 40 deletions(-) delete mode 100755 ansible-playbook-workaround create mode 100644 config/ansible.hosts diff --git a/.gitmodules b/.gitmodules index 631caf1..b558fac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "ansible"] path = ansible - url = https://github.com/tootsuite/mastodon-ansible.git + url = https://github.com/tootsuite/mastodon-ansible diff --git a/ansible-playbook-workaround b/ansible-playbook-workaround deleted file mode 100755 index 3f9c480..0000000 --- a/ansible-playbook-workaround +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -if [ "${1}" == "--version" ] ; then - echo "ansible-playbook 2.2.2.0" - exit 0 -fi - -exec ansible-playbook "$@" diff --git a/config/ansible.hosts b/config/ansible.hosts new file mode 100644 index 0000000..2302eda --- /dev/null +++ b/config/ansible.hosts @@ -0,0 +1 @@ +localhost ansible_connection=local diff --git a/packer.atlas.json b/packer.atlas.json index b88fe62..72a5519 100644 --- a/packer.atlas.json +++ b/packer.atlas.json @@ -5,16 +5,13 @@ }, "provisioners": [ { - "type": "shell-local", - "command": "sudo apt-get update -qq" - }, - { - "type": "shell-local", - "command": "sudo apt-get install -y ansible git-core" - }, - { - "type": "shell-local", - "command": "git submodule update --recurse --init" + "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": [ @@ -32,23 +29,30 @@ ] }, { - "type": "ansible", - "playbook_file": "ansible/playbook.yml", - "command": "./ansible-playbook-workaround", - "extra_arguments": [ "--extra-vars", "mastodon_db_password=CHANGEME" ], - "ansible_env_vars": [ - "ANSIBLE_REMOTE_TEMP=\"~/.ansible-tmp\"", - "ANSIBLE_SSH_PIPELINING=True" + "type": "shell", + "inline": [ + "virtualenv venv", + ". venv/bin/activate", + "pip install --upgrade ansible==2.2.2.0" ] }, - { "type": "shell", - "execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'", - "script": "scripts/clean.sh" + { + "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/playbook.yml" + ] }, { "type": "shell", "execute_command": "{{ .Vars }} sudo -E -S sh '{{ .Path }}'", - "script": "scripts/minimize.sh" + "scripts": ["scripts/clean.sh", "scripts/minimize.sh"] } ], "builders": [ @@ -117,20 +121,12 @@ "metadata": { "created_at": "{{timestamp}}", "description": "A Vagrant image for Mastodon development", - "provider": "virtualbox-iso", - "version": "{{isotime \"20060102T15_04_05\"}}.0" + "provider": "virtualbox-iso" } } ], "push": { "name": "mastodon/ubuntu-xenial64", - "vcs": false, - "include": [ - ".git*", - ".git/*", - ".git/**/*", - "preseeds/*", - "scripts/*" - ] + "vcs": true } }