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 "$?";