commit 20a991fad602ea36b55136e854b563037f5e02f5 Author: Guillaume Raffy Date: Wed Oct 11 17:36:07 2023 +0200 added scripts to ease applying debops on machines diff --git a/bin/debops.init-machine.bash b/bin/debops.init-machine.bash new file mode 100755 index 0000000..d6da393 --- /dev/null +++ b/bin/debops.init-machine.bash @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +TARGET_HOST_FQDN="$1" # the machine on which we want to install debops bootstrap + +set -o errexit + +REPORTS_DIR="$HOME/work/debops/reports" +mkdir -p "${REPORTS_DIR}" +REPORT_FILE_PATH=${REPORTS_DIR}/$(date --iso=seconds)-init-${TARGET_HOST_FQDN} +echo "installing debops bootstrap on ${TARGET_HOST_FQDN} (report stored in ${REPORT_FILE_PATH})" +pushd $HOME/work/debops/ansible.debops + source ../debops-venv/bin/activate + ANS_HOST=$(echo ${TARGET_HOST_FQDN} | sed -E 's/\.univ-rennes[1]?\.fr$//') + echo "ANS_HOST=${ANS_HOST}" + debops run bootstrap-ldap -l "${ANS_HOST:-/dev/null}" | tee --append ${REPORT_FILE_PATH} + deactivate +popd + diff --git a/bin/debops.update-debops.bash b/bin/debops.update-debops.bash new file mode 100755 index 0000000..0cf24ea --- /dev/null +++ b/bin/debops.update-debops.bash @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -o errexit + +REPORTS_DIR="$HOME/work/debops/reports" +mkdir -p "${REPORTS_DIR}" +REPORT_FILE_PATH=${REPORTS_DIR}/$(date --iso=seconds)-update-debops +echo "updating debops itself" +pushd $HOME/work/debops/ansible.debops + source ../debops-venv/bin/activate + git pull | tee --append ${REPORT_FILE_PATH} + ./bin/update-prod.sh | tee --append ${REPORT_FILE_PATH} + ./bin/update-dev.sh | tee --append ${REPORT_FILE_PATH} + deactivate +popd + diff --git a/bin/debops.update-machine.bash b/bin/debops.update-machine.bash new file mode 100755 index 0000000..d7f62a6 --- /dev/null +++ b/bin/debops.update-machine.bash @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +TARGET_HOST_FQDN="$1" # the machine on which we want to apply debops + +set -o errexit + +REPORTS_DIR="$HOME/work/debops/reports" +mkdir -p "${REPORTS_DIR}" +REPORT_FILE_PATH=${REPORTS_DIR}/$(date --iso=seconds)-update-${TARGET_HOST_FQDN} +echo "applying debops configuration on ${TARGET_HOST_FQDN} (report stored in ${REPORT_FILE_PATH})" +pushd $HOME/work/debops/ansible.debops + source ../debops-venv/bin/activate + ANS_HOST=$(echo ${TARGET_HOST_FQDN} | sed -E 's/\.univ-rennes[1]?\.fr$//') + echo "ANS_HOST=${ANS_HOST}" + debops run site --limit "${ANS_HOST:-/dev/null}" | tee --append ${REPORT_FILE_PATH} + deactivate +popd