-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.sh
executable file
·74 lines (60 loc) · 1.8 KB
/
post.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
# RUN wraps the command to log into journalctl
RUN() {
logger -t postscripts "Running $*..."
echo "---Running $*...---"
"$@"
code=$?
if [ $code -eq 1 ]; then
logger -t postscripts "$* failed with error code $code"
echo "---$* failed with error code $code---"
elif [ $code -ne 0 ]; then
logger -t postscripts "$* exited with error code $code"
echo "---$* exited with error code $code---"
fi
logger -t postscripts "$* exited with code $code"
echo "---$* exited with code $code---"
}
COPY() {
mkdir -p "$(dirname "$2")"
rsync -av "$1" "$2"
}
SCRIPTPATH=$(dirname "$(realpath "$0")")
# -- SYNCLIST
cd "${SCRIPTPATH}/files" || (echo "cd failed" && exit 1)
COPY ./sssd/sssd.conf /etc/sssd/sssd.conf
COPY ./ssh/ /etc/ssh/
find /etc/ssh -type f -exec chmod 600 {} \;
find /etc/ssh -type d -exec chmod 700 {} \;
systemctl restart sshd
COPY ./munge/munge.key /etc/munge/munge.key
COPY ./slurm/slurmd_defaults /etc/default/slurmd
COPY ./slurm/prolog.d/ /etc/slurm/prolog.d/
COPY ./slurm/epilog.d/ /etc/slurm/epilog.d/
COPY ./slurm/plugstack.conf.d/ /etc/slurm/plugstack.conf.d/
COPY ./certs/ /etc/pki/ca-trust/source/anchors/
update-ca-trust
systemctl restart sssd
# -- APPEND
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPd+X08wpIGwKZ0FsJu1nkR3o1CzlXF3OkgQd/WYB2fX deepsquare" >>/root/.ssh/authorized_keys
chmod 600 /root/.ssh/*
chmod 700 /root/.ssh
# Restore context
cd "${SCRIPTPATH}" || (echo "cd failed" && exit 1)
# -- EXECUTE (use RUN to log your postscripts)
PATH="${SCRIPTPATH}/postscripts:$PATH"
chmod +x "${SCRIPTPATH}/postscripts/"*
RUN disable-beegfs
RUN install-bore
RUN symlink-ca
RUN restorecap
RUN ldap
RUN fs_mount
RUN slurm
RUN install-logger
RUN cvmfs_mount
RUN setups5cmd
RUN install-pasta
RUN set-motd
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv6.conf.all.forwarding=1