expand to multiple hosts starting with tp
[automated-distro-installer] / fai-redep
1 #!/bin/bash -lx
2
3 # Deploy fai configuration to faiserver,
4 # then start a virtual machine to test the config.
5
6 set -eE -o pipefail
7 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
8
9 ssh root@faiserver rm -rf /srv/fai/config/\*
10 scp -r /a/bin/fai/fai/config root@faiserver:/srv/fai
11 # fai example pass: fai
12 #ROOTPW='$1$kBnWcO.E$djxB128U7dMkrltJHPf6d1'
13
14 # generating a hashed password:
15 # under debian, you can do
16 # echo "yoursecrectpassword" | mkpasswd -m sha-512 -s
17 # On arch, best seems to be copy your shadow file to a temp location,
18 # then passwd, get out the new pass, then copy the shadow file back.
19 ssh root@faiserver tee -a /srv/fai/config/class/DEFAULT.var <<EOF
20 ROOTPW='$(cat /p/shadow/standard)'
21 EOF
22 scp ~/.ssh/id_rsa.pub \
23 root@faiserver:/srv/fai/config/files/home/ian/.ssh/authorized_keys/GRUB_PC
24 s scp -r /q/root/luks root@faiserver:/srv/fai/config/distro-install-common
25 ssh root@faiserver chmod -R a+rX /srv/fai/config/distro-install-common
26