From 5f0cbcd4277ead034ac6100c6c15803b84dbb5c2 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Fri, 26 Nov 2021 00:48:42 +0000 Subject: [PATCH] initial cluster-config postinstall step --- .../100-ssh-cluster-config.sh | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 src/steps-postinstall/100-ssh-cluster-config.sh diff --git a/src/steps-postinstall/100-ssh-cluster-config.sh b/src/steps-postinstall/100-ssh-cluster-config.sh new file mode 100755 index 0000000..c21fcd2 --- /dev/null +++ b/src/steps-postinstall/100-ssh-cluster-config.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +task_begin "Configuring ssh"; + +while read -r username; do + sudo -u "${username}" bash -c 'ssh -T git@git.starbeamrainbowlabs.com || ssh-keyscan -H git.starbeamrainbowlabs.com >>$HOME/.ssh/known_hosts'; +done < <(find /home -mindepth 1 -maxdepth 1 -type d); + +ssh -T git@git.starbeamrainbowlabs.com || ssh-keyscan -H git.starbeamrainbowlabs.com >>/root/.ssh/known_hosts + +task_end "$?"; + + +task_begin "Cloning /etc/cluster-config"; + +if [[ -d /etc/cluster-config ]]; then + cd "/etc/cluster-config" || { echo "Failed to cd into /etc/cluster-config even though it seems to exist"; exit 1; }; + git pull; +else + git clone git@git.starbeamrainbowlabs.com:sbrl/cluster-config.git /etc/cluster-config; +fi + +task_end "$?";