#!/bin/sh

NODES=`cat /root/nodes-2-20`

VMNAME="b2007cel-v"
VMDIR="/VM/${VMNAME}"
SRCDST="${VMDIR}/systemd"
UNITDIR="/lib/systemd/system"

cp ${SRCDST}/windows-vm* ${UNITDIR}/ && systemctl daemon-reload && systemctl enable windows-vm

for _node in ${NODES}; do
	ssh ${_node} "hostname; [ -d ${SRCDST} ] || mkdir -p ${SRCDST}"
	scp ${SRCDST}/monitor.sh ${_node}:/${SRCDST}/monitor.sh
	scp ${SRCDST}/windows-vm* ${_node}:/${SRCDST}/
	ssh ${_node} "cp ${SRCDST}/windows-vm* ${UNITDIR}/ && systemctl daemon-reload && systemctl enable windows-vm"
done
