blob: 012ccbb5b11d2b36dbda425d760766fd42ea6501 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# Simple Makefile to build packer templates
# TODO:
# - allow overriding packer variables
# - check for hypervisors (and invalidate targets)
# - provisioning logic
BUILDERS = qemu vmware-iso virtualbox-iso
TEMPLATES := $(basename $(filter-out base.json,$(wildcard *.json)))
TARGETS := $(foreach builder, $(BUILDERS), $(foreach template, $(TEMPLATES), $(builder)/$(template)))
PACKER_OPTS := -var-file=base.json
.PHONY: all list clean
all: list
$(TARGETS):
ifndef ROOTPW
$(error ROOTPW is not set)
endif
$(info Building '$(@F)' with '$(@D)')
packer build -only=$(@D) \
$(PACKER_OPTS) \
-var='vm_name=$(@F)' \
$(@F).json
list:
$(info Possible targets:)
@(for F in $(TARGETS); do echo -e "\t$$F" ; done)
clean:
$(foreach builder,$(BUILDERS),rm -rf $(builder)/;)
# convenience do-nothing targets for auto-complete
qemu/ubuntu-16.04-amd64:
qemu/centos-7.3-x86_64:
virtualbox-iso/ubuntu-16.04-amd64:
virtualbox-iso/centos-7.3-x86_64:
vmware-iso/ubuntu-16.04-amd64:
vmware-iso/centos-7.3-x86_64:
|