cluster-deployment/src/steps-last/10-ssh-cluster-config.sh

25 lines
796 B
Bash
Executable File

#!/usr/bin/env bash
task_begin "Configuring ssh";
while read -r username; do
username="$(basename "${username}")"; # find outputs the full path
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 "$?";