From 4a85989bd33ba7e81f59c6269130e383d09b0bac Mon Sep 17 00:00:00 2001 From: Moritz Heiber Date: Sun, 23 Apr 2017 13:52:48 +0200 Subject: [PATCH] Updated Ansible scripts, update cleanup script, update README --- README.md | 2 ++ ansible | 2 +- packer.json | 6 +++++- scripts/clean.sh | 20 ++++++++++++++++---- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b81d138..b5a9ce7 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ This VirtualBox base image contains all the required packages and configuration for running/instantiating a Mastodon instance for development. It is build using [Hashicorp's Packer](https://packer.io), the provisioning is done with Ansible through a dedicated git submodule called [mastodon-ansible](https://github.com/moritzheiber/mastodon-ansible). The tests are using [ServerSpec](https://serverspec.org). The image is build continuously using [Hashicorp Atlas](https://atlas.hashicorp.com). +_Note: Some of the content of the scripts in `scripts/` is borrowed from the [Bento](https://github.com/chef/bento) project._ + ## Prerequisites (for building on your own) - VirtualBox >= 5.1.x diff --git a/ansible b/ansible index 378f7d3..ce3f400 160000 --- a/ansible +++ b/ansible @@ -1 +1 @@ -Subproject commit 378f7d3aab1a724e5e9b53046702fa50a9671694 +Subproject commit ce3f40045311ef20b74dc08915348de819012016 diff --git a/packer.json b/packer.json index dd186eb..ec60a09 100644 --- a/packer.json +++ b/packer.json @@ -22,7 +22,11 @@ { "type": "ansible", "playbook_file": "ansible/playbook.yml", - "extra_arguments": [ "--extra-vars", "\"mastodon_db_password=CHANGEME mastodon_db_login_unix_socket=/var/run/postgresql\"" ] + "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 }}'", diff --git a/scripts/clean.sh b/scripts/clean.sh index f8ccec2..8f212a8 100755 --- a/scripts/clean.sh +++ b/scripts/clean.sh @@ -6,12 +6,12 @@ dpkg --list \ | grep 'linux-headers' \ | xargs apt-get -y purge; -# Remove specific Linux kernels, such as linux-image-3.11.0-15 but +# Remove specific Linux kernels, such as linux-image-3.11.0-15-generic but # keeps the current kernel and does not touch the virtual packages, -# e.g. 'linux-image-amd64', etc. +# e.g. 'linux-image-generic', etc. dpkg --list \ | awk '{ print $2 }' \ - | grep 'linux-image-[234].*' \ + | grep 'linux-image-.*-generic' \ | grep -v `uname -r` \ | xargs apt-get -y purge; @@ -21,6 +21,12 @@ dpkg --list \ | grep linux-source \ | xargs apt-get -y purge; +# delete docs packages +dpkg --list \ + | awk '{ print $2 }' \ + | grep -- '-doc$' \ + | xargs apt-get -y purge; + # Delete X11 libraries apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6; @@ -28,10 +34,16 @@ apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6; apt-get -y purge ppp pppconfig pppoeconf; # Delete oddities -apt-get -y purge popularity-contest; +apt-get -y purge popularity-contest installation-report command-not-found command-not-found-data friendly-recovery; apt-get -y autoremove; apt-get -y clean; +# Remove docs +rm -rf /usr/share/doc/* + +# Remove caches +find /var/cache -type f -exec rm -rf {} \; + # delete any logs that have built up during the install find /var/log/ -name *.log -exec rm -f {} \;