export VMNAME := ubuntu1804
export DISK_DIR := /storage/scratch/tmp
export HOST := las1.local

.PHONY: clean install reinstall rcopy rrun

default: remote

clean:
	-virsh destroy $(VMNAME)
	-virsh undefine $(VMNAME)
	rm -f $(DISK_DIR)/$(VMNAME).qcow2

install:
	bash install.sh

reinstall: clean install

remote: rrun

rcopy:
	rsync -avP ./ root@$(HOST):/storage/admin/vms/

rrun: rcopy
	ssh -t root@$(HOST) "cd /storage/admin/vms && make reinstall"

rclean: rcopy
	ssh -t root@$(HOST) "cd /storage/admin/vms && make clean"

