diff --git a/Vagrantfile b/Vagrantfile --- a/Vagrantfile +++ b/Vagrantfile @@ -1,8 +1,9 @@ Vagrant.require_version ">= 2.2.0" ENV["LC_ALL"] = "en_US.UTF-8" +tmpdir = "/var/tmp/puppet" # Default configuration for all defines node below -environment_path = "/tmp/puppet/environments" +environment_path = "#{tmpdir}/environments" manifest_file = "site.pp" manifests_path = "swh-site/manifests" puppet_options = "--fileserverconfig=/etc/puppet/fileserver.conf --verbose" # --debug --trace" @@ -555,11 +556,11 @@ config.vm.network :private_network, ip: vm_props[:ip], netmask: "255.255.0.0" # Using nfs v4 to avoid using the default nfs v3 on udp not supported by the debian 11 kernel - config.vm.synced_folder "/tmp/puppet/", _mount_point_puppet, type: 'nfs', nfs_version:4 + config.vm.synced_folder tmpdir, _mount_point_puppet, type: 'nfs', nfs_version:4 # Hack to speed up the puppet provisioner rsync # It will synchronize between the same source and destination - config.vm.synced_folder "/tmp/puppet/", '/vagrant', type: 'nfs', nfs_version:4 - config.vm.synced_folder "/tmp/puppet/", '/vagrant-puppet', type: 'nfs', nfs_version:4 + config.vm.synced_folder tmpdir, '/vagrant', type: 'nfs', nfs_version:4 + config.vm.synced_folder tmpdir, '/vagrant-puppet', type: 'nfs', nfs_version:4 # ssl certificates share config.vm.synced_folder "vagrant/le_certs", "/var/lib/puppet/letsencrypt_exports", type: 'nfs', nfs_version:4 diff --git a/bin/prepare-vagrant-conf b/bin/prepare-vagrant-conf --- a/bin/prepare-vagrant-conf +++ b/bin/prepare-vagrant-conf @@ -7,21 +7,25 @@ FACTS_DIR="${OCD_BASE}/facts" function usage { - echo "usage: $0 [-b/--branch branch]" + echo "usage: $0 [-b/--branch branch] [-t/--tmpdir tmp-dir] " } -CLEAN_TMPDIR=true USE_REMOTE_REPOS=false FROM=production TO=staging HOSTS=() OCTOCATALOG_DIFF_ARGS= R10K_ARGS= -CLEAN_TMPDIR=false UNCOMMITTED=false +# default value +TMPDIR=/var/tmp/puppet while (( "$#" )); do case "$1" in + -t|--tmpdir) + TMPDIR=$2 + shift + ;; -b|--branch) BRANCH=$2 shift @@ -36,9 +40,8 @@ shift done -TMPDIR=/tmp/puppet -mkdir -p /tmp/puppet -rm -rf /tmp/puppet/environments/ +mkdir -p $TMPDIR +rm -rf $TMPDIR/environments/ function template { sed -e "s#@PUPPET_ENV@#${PUPPET_ENV}#g" -e "s#@TMPDIR@#${TMPDIR}#g" $1 > $2 diff --git a/bin/sync-vagrant-conf b/bin/sync-vagrant-conf --- a/bin/sync-vagrant-conf +++ b/bin/sync-vagrant-conf @@ -8,9 +8,10 @@ set -ex WD=$(dirname $0) +TMPDIR=${1-/var/tmp/puppet} -if [ ! -d /tmp/puppet ]; then - $WD/prepare-vagrant-conf +if [ ! -d $TMPDIR ]; then + $WD/prepare-vagrant-conf --tmpdir $TMPDIR fi -$WD/watch-vagrant-conf +$WD/watch-vagrant-conf $TMPDIR diff --git a/bin/watch-vagrant-conf b/bin/watch-vagrant-conf --- a/bin/watch-vagrant-conf +++ b/bin/watch-vagrant-conf @@ -2,6 +2,7 @@ set -e +TMPDIR=${1-/var/tmp/puppet} PUPPET_ENV=$(readlink -f $(dirname $0)/..) RSYNC_PARAMS="-a --progress" @@ -17,9 +18,9 @@ function sync_puppet_conf { branch=$1 - rsync $RSYNC_PARAMS $EXCLUDES_PARAMS swh-site/data/ /tmp/puppet/environments/${branch}/data - rsync $RSYNC_PARAMS $EXCLUDES_PARAMS swh-site/site-modules/ /tmp/puppet/environments/${branch}/site-modules/ - rsync $RSYNC_PARAMS $EXCLUDES_PARAMS private/swh-private-data-censored/ /tmp/puppet/environments/${branch}/data/private + rsync $RSYNC_PARAMS $EXCLUDES_PARAMS swh-site/data/ $TMPDIR/environments/${branch}/data + rsync $RSYNC_PARAMS $EXCLUDES_PARAMS swh-site/site-modules/ $TMPDIR/environments/${branch}/site-modules/ + rsync $RSYNC_PARAMS $EXCLUDES_PARAMS private/swh-private-data-censored/ $TMPDIR/environments/${branch}/data/private } # Initial sync