working test raid setup
[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 ssh root@faiserver tee -a /srv/fai/config/class/DESKTOP.var <<EOF
12 ROOTPW='$(cat /p/shadow/standard)'
13 EOF
14 scp ~/.ssh/id_rsa.pub \
15 root@faiserver:/srv/fai/config/files/home/ian/.ssh/authorized_keys/DESKTOP
16 s scp -r /q/root/luks root@faiserver:/srv/fai/config/distro-install-common
17 ssh root@faiserver chmod -R a+r /srv/fai/config/distro-install-common
18
19 s virshrm demohost ||:
20 # this one doesn't need to be done every time
21 s qemu-img create -o preallocation=metadata -f qcow2 \
22 /var/lib/libvirt/images/demohost 30G
23 s qemu-img create -o preallocation=metadata -f qcow2 \
24 /var/lib/libvirt/images/demohostb 30G
25 # osinfo-query os | gr jessie
26 s virt-install --os-variant debian8 --cpu host -n demohost --pxe -r 2048 --vcpus 1 \
27 --disk path=/var/lib/libvirt/images/demohost \
28 --disk path=/var/lib/libvirt/images/demohostb -w bridge=br0,mac=52:54:00:9c:ef:ad