4 # shellcheck disable=SC1090
5 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
7 # KVM, compute node prereqs (libvirt first), VCP deployment
8 salt -C 'kvm*' pkg.install bridge-utils
9 salt -C 'kvm*' state.apply linux.network
10 salt -C 'kvm*' system.reboot
11 wait_for 90 "! salt 'kvm*' test.ping | tee /dev/stderr | grep -Fq 'Not connected'"
13 salt -C '* and not cfg01* and not mas01*' state.apply linux,ntp
15 salt -C 'kvm*' state.sls libvirt
17 salt -C '* and not cfg01* and not mas01*' state.apply salt
18 salt -C 'kvm*' saltutil.sync_all
19 wait_for 10 "! salt -C 'kvm*' state.sls salt.control | " \
20 "tee /dev/stderr | grep -Fq 'Not connected'"
22 vcp_nodes=$(salt --out yaml 'kvm01*' pillar.get salt:control:cluster:internal:node | \
23 awk '/\s+\w+:$/ {gsub(/:$/, "*"); print $1}')
25 # Check all vcp nodes are available
27 while [ $rc -ne 0 ]; do
29 for node in $vcp_nodes; do
30 salt "$node" test.ping 2>/dev/null || { rc=$?; break; };
35 wait_for 10 "salt -C '* and not cfg01* and not mas01*' saltutil.sync_all"
36 wait_for 10 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply salt"
37 wait_for 10 "! salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' state.apply linux,ntp | " \
38 "tee /dev/stderr | grep -Fq 'Not connected'"
40 wait_for 10 "salt -C 'E@^(?!cfg01|mas01|kvm|cmp00).*' ssh.set_auth_key ${SUDO_USER} \
41 $(awk 'NR==1{print $2}' "$(eval echo "~${SUDO_USER}/.ssh/authorized_keys")")"