diff --git a/playbooks/roles/edx_ansible/tasks/deploy.yml b/playbooks/roles/edx_ansible/tasks/deploy.yml
index fd395bd..c6eb0d5 100644
--- a/playbooks/roles/edx_ansible/tasks/deploy.yml
+++ b/playbooks/roles/edx_ansible/tasks/deploy.yml
@@ -53,6 +53,7 @@
     mode: "0755"
   with_items:
     - { src: 'show-repo-heads.j2', dest: 'show-repo-heads' }
+    - { src: 'pre-box.j2', dest: 'pre-box' }
   tags:
     - install
     - install:configuration
diff --git a/playbooks/roles/edx_ansible/templates/pre-box.j2 b/playbooks/roles/edx_ansible/templates/pre-box.j2
new file mode 100644
index 0000000..8b2859e
--- /dev/null
+++ b/playbooks/roles/edx_ansible/templates/pre-box.j2
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+#
+# Remove needless noise from file systems before packaging a Vagrant box file.
+# This can reduce the size of the box file by 25%.
+# Run this with sudo in the guest OS just before "vagrant package" in the host.
+
+set -x
+
+# Discard packages we don't need.
+apt-get clean -y
+apt-get autoclean -y 
+
+# Clean out pip caches.
+find / -type d -path '*/.cache/pip' -print -exec rm -rf '{}/*' \;
+
+# Remove all the .pyc files.
+find /edx/app -name '*.pyc' -delete
+
+# Last thing: fill the disk with zeros so they'll compress well.
+# The dd command fails because the disk fills, which is the point, so silence
+# the error.
+dd if=/dev/zero of=/empty bs=1M || true
+rm -f /empty