#!/usr/bin/env bash set -e # start sshd server _sshd_host() { if [ ! -d /var/run/sshd ]; then mkdir /var/run/sshd ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' fi /usr/sbin/sshd } # setup worker ssh to be passwordless _ssh_worker() { if [[ ! -d /home/worker ]]; then mkdir -p /home/worker chown -R worker:worker /home/worker fi cat > /home/worker/setup-worker-ssh.sh < ~/.ssh/authorized_keys chmod 0640 ~/.ssh/authorized_keys cat >> ~/.ssh/config < /etc/munge/munge.key" chown munge: /etc/munge/munge.key chmod 400 /etc/munge/munge.key sudo -u munge /sbin/munged munge -n munge -n | unmunge remunge } # copy secrets to /.secret directory for other nodes _copy_secrets() { cp /home/worker/worker-secret.tar.gz /.secret/worker-secret.tar.gz cp /home/worker/setup-worker-ssh.sh /.secret/setup-worker-ssh.sh cp /etc/munge/munge.key /.secret/munge.key rm -f /home/worker/worker-secret.tar.gz rm -f /home/worker/setup-worker-ssh.sh } # generate slurm.conf _generate_slurm_conf() { cat > /etc/slurm/slurm.conf <