From eae06d9028e4e70a211afef4a73b971067203da1 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sun, 17 Jan 2016 18:59:51 -0800 Subject: [PATCH] expand to multiple hosts starting with tp --- fai-redep | 9 ---- fai-revm | 21 ++++++++++ fai/config/class/50-host-classes | 42 ++++++++++--------- fai/config/hooks/extrbase.DEFAULT | 8 ++++ fai/config/hooks/extrbase.demohost | 3 -- .../{instsoft.demohost => instsoft.DEFAULT} | 5 +++ .../{partition.demohost => partition.DEFAULT} | 26 ++++++++---- 7 files changed, 76 insertions(+), 38 deletions(-) create mode 100755 fai-revm create mode 100755 fai/config/hooks/extrbase.DEFAULT delete mode 100755 fai/config/hooks/extrbase.demohost rename fai/config/hooks/{instsoft.demohost => instsoft.DEFAULT} (63%) rename fai/config/hooks/{partition.demohost => partition.DEFAULT} (91%) diff --git a/fai-redep b/fai-redep index d7ba004..1626272 100755 --- a/fai-redep +++ b/fai-redep @@ -24,12 +24,3 @@ scp ~/.ssh/id_rsa.pub \ s scp -r /q/root/luks root@faiserver:/srv/fai/config/distro-install-common ssh root@faiserver chmod -R a+rX /srv/fai/config/distro-install-common -s virshrm demohost ||: - -for f in /var/lib/libvirt/images/demohost{,b}; do - [[ -e $f ]] || s qemu-img create -o preallocation=metadata -f qcow2 $f 30G -done -# osinfo-query os | gr jessie -s virt-install --os-variant debian8 --cpu host -n demohost --pxe -r 2048 --vcpus 1 \ - --disk path=/var/lib/libvirt/images/demohost \ - --disk path=/var/lib/libvirt/images/demohostb -w bridge=br0,mac=52:54:00:9c:ef:ad diff --git a/fai-revm b/fai-revm new file mode 100755 index 0000000..3b3e003 --- /dev/null +++ b/fai-revm @@ -0,0 +1,21 @@ +#!/bin/bash -lx + +# Deploy fai configuration to faiserver, +# then start a virtual machine to test the config. + +set -eE -o pipefail +trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR + +cd "${BASH_SOURCE%/*}" + +./fai-redep + +s virshrm demohost ||: + +for f in /var/lib/libvirt/images/demohost{,b}; do + [[ -e $f ]] || s qemu-img create -o preallocation=metadata -f qcow2 $f 30G +done +# osinfo-query os | gr jessie +s virt-install --os-variant debian8 --cpu host -n demohost --pxe -r 2048 --vcpus 1 \ + --disk path=/var/lib/libvirt/images/demohost \ + --disk path=/var/lib/libvirt/images/demohostb -w bridge=br0,mac=52:54:00:9c:ef:ad diff --git a/fai/config/class/50-host-classes b/fai/config/class/50-host-classes index f7bda8a..5b38bb6 100755 --- a/fai/config/class/50-host-classes +++ b/fai/config/class/50-host-classes @@ -7,27 +7,31 @@ # use a list of classes for our demo machine case $HOSTNAME in - faiserver) - echo "FAIBASE DEBIAN DEMO FAISERVER" ;; demohost) - echo "FAIBASE DEBIAN" ;; - xfcehost) - echo "FAIBASE DEBIAN DEMO XORG XFCE LVM";; - gnomehost) - echo "FAIBASE DEBIAN DEMO XORG GNOME";; - centos) - echo "FAIBASE CENTOS" # you may want to add class XORG here - ifclass I386 && echo CENTOS6_32 # AFAIK there's no 32bit C7 - ifclass AMD64 && echo CENTOS7_64 - exit 0 ;; # CentOS does not use the GRUB class - slchost) - # Scientific Linux Cern, is very similar to CentOS. SLC should alsways use the class CENTOS - echo "FAIBASE CENTOS SLC" # you may want to add class XORG here - ifclass I386 && echo SLC7_32 - ifclass AMD64 && echo SLC7_64 - exit 0 ;; # CentOS/SLC does not use the GRUB class + echo "FAIBASE DEBIAN DESKTOP" ;; + x2) + echo "FAIBASE DEBIAN DESKTOP ONE_DISK" ;; + tp) + echo "FAIBASE DEBIAN DESKTOP TWO_DISK" ;; + # faiserver) + # echo "FAIBASE DEBIAN DEMO FAISERVER" ;; + # xfcehost) + # echo "FAIBASE DEBIAN DEMO XORG XFCE LVM";; + # gnomehost) + # echo "FAIBASE DEBIAN DEMO XORG GNOME";; + # centos) + # echo "FAIBASE CENTOS" # you may want to add class XORG here + # ifclass I386 && echo CENTOS6_32 # AFAIK there's no 32bit C7 + # ifclass AMD64 && echo CENTOS7_64 + # exit 0 ;; # CentOS does not use the GRUB class + # slchost) + # # Scientific Linux Cern, is very similar to CentOS. SLC should alsways use the class CENTOS + # echo "FAIBASE CENTOS SLC" # you may want to add class XORG here + # ifclass I386 && echo SLC7_32 + # ifclass AMD64 && echo SLC7_64 + # exit 0 ;; # CentOS/SLC does not use the GRUB class *) - echo "FAIBASE DEBIAN" ;; + echo "FAIBASE DEBIAN DESKTOP" ;; esac if grep ^52:54:00: /sys/class/net/eth0/address &>/dev/null; then diff --git a/fai/config/hooks/extrbase.DEFAULT b/fai/config/hooks/extrbase.DEFAULT new file mode 100755 index 0000000..fe3eda5 --- /dev/null +++ b/fai/config/hooks/extrbase.DEFAULT @@ -0,0 +1,8 @@ +#!/bin/bash + +# exit for any vm which is not our test vm +if ifclass VM && ! ifclass demohost; then + exit 0 +fi + +chattr -Rf +C /target diff --git a/fai/config/hooks/extrbase.demohost b/fai/config/hooks/extrbase.demohost deleted file mode 100755 index 3f5e25c..0000000 --- a/fai/config/hooks/extrbase.demohost +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -chattr -Rf +C /target diff --git a/fai/config/hooks/instsoft.demohost b/fai/config/hooks/instsoft.DEFAULT similarity index 63% rename from fai/config/hooks/instsoft.demohost rename to fai/config/hooks/instsoft.DEFAULT index fa93c6b..d2a8f76 100755 --- a/fai/config/hooks/instsoft.demohost +++ b/fai/config/hooks/instsoft.DEFAULT @@ -1,5 +1,10 @@ #!/bin/bash +# exit for any vm which is not our test vm +if ifclass VM && ! ifclass demohost; then + exit 0 +fi + f=$target/root/keyscript cat > $f <