Factor out the bulk of the provision script for re-use across environments.