3 # Deploy fai configuration to faiserver,
4 # then start a virtual machine to test the config.
7 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
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'
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)'
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
+r
/srv
/fai
/config
/distro-install-common
27 s virshrm demohost ||
:
28 # this one doesn't need to be done every time
29 s qemu-img create
-o preallocation
=metadata
-f qcow2 \
30 /var
/lib
/libvirt
/images
/demohost
30G
31 s qemu-img create
-o preallocation
=metadata
-f qcow2 \
32 /var
/lib
/libvirt
/images
/demohostb
30G
33 # osinfo-query os | gr jessie
34 s virt-install
--os-variant debian8
--cpu host -n demohost
--pxe -r 2048 --vcpus 1 \
35 --disk path
=/var
/lib
/libvirt
/images
/demohost \
36 --disk path
=/var
/lib
/libvirt
/images
/demohostb
-w bridge
=br0
,mac
=52:54:00:9c
:ef
:ad