42 lines
1.2 KiB
Makefile
42 lines
1.2 KiB
Makefile
VM_STATE_RUNNING ?= true
|
|
|
|
all: build_all alpine-qemu
|
|
|
|
build_all: checksum alpine-qemu.pkr.hcl alpine-libvirt.pkr.hcl
|
|
|
|
alpine-qemu.pkr.hcl: clean
|
|
@packer validate $@
|
|
@packer build -on-error=abort $@
|
|
|
|
# By default Packer will build all sources at the same time
|
|
# We explicitly make it build in order here
|
|
alpine-libvirt.pkr.hcl: clean
|
|
@packer init -upgrade $@
|
|
@packer validate $@
|
|
@echo "==> Building QEMU box ..."
|
|
@packer build -on-error=abort -only="*.alpine-qemu-uefi" $@
|
|
@echo "==> Importing QEMU box as libvirt domain ..."
|
|
@packer build -on-error=abort -only="*.alpine-libvirt" $@
|
|
|
|
alpine-qemu:
|
|
@terraform -chdir=./terraform/alpine-qemu init -upgrade -migrate-state
|
|
@terraform -chdir=./terraform/alpine-qemu validate
|
|
@terraform -chdir=./terraform/alpine-qemu apply -var="running=$(VM_STATE_RUNNING)"
|
|
|
|
format-packer:
|
|
@packer fmt -diff -recursive .
|
|
|
|
format-terraform:
|
|
@terraform fmt -diff -recursive ./terraform/
|
|
|
|
clean:
|
|
@find ./artifacts/* -prune -exec rm -rfv {} \;
|
|
|
|
destroy:
|
|
@find ./terraform/* -prune -exec terraform -chdir={} apply -destroy \;
|
|
|
|
checksum:
|
|
@find . -name *.pkr.hcl -type f -exec sh update_iso_checksum.sh {} \;
|
|
|
|
.PHONY: all build_all alpine-qemu.pkr.hcl alpine-libvirt.pkr.hcl alpine-qemu format-packer format-terraform clean destroy checksum
|