diff options
author | Michael Janczyk | 2023-08-08 17:56:47 +0200 |
---|---|---|
committer | Michael Janczyk | 2023-08-08 17:56:47 +0200 |
commit | 6d5b468262ff35ae62cb70627e2377eb0188253f (patch) | |
tree | 77b232d81fd3d78e320def324c195cf4e2ad7f73 | |
parent | Makefile great again (diff) | |
download | packer-templates-6d5b468262ff35ae62cb70627e2377eb0188253f.tar.gz packer-templates-6d5b468262ff35ae62cb70627e2377eb0188253f.tar.xz packer-templates-6d5b468262ff35ae62cb70627e2377eb0188253f.zip |
Makefile: correct tabs and spaces to work correctly.
-rw-r--r-- | hcl2/Makefile | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/hcl2/Makefile b/hcl2/Makefile index 77fe366..6c8628d 100644 --- a/hcl2/Makefile +++ b/hcl2/Makefile @@ -1,79 +1,79 @@ # Simple Makefile to build base VM images using packer and ansible # TODO -# * support ssh as user instead of root -# * testing target -PACKER ?= packer -ANSIBLE_DIR_BOOT ?= ansible-dracut -ANSIBLE_DIR_PROV ?= ansible-roles-prov -HASHER ?= sha256sum -SHELL := /usr/bin/env bash -BUILDS := builds +# * support ssh as user instead of root +# * testing target +PACKER ?= packer +ANSIBLE_DIR_BOOT ?= ansible-dracut +ANSIBLE_DIR_PROV ?= ansible-roles-prov +HASHER ?= sha256sum +SHELL := /usr/bin/env bash +BUILDS := builds -ARCH := $(shell uname -m | sed 's/i686/i386/') +ARCH := $(shell uname -m | sed 's/i686/i386/') -AVAILABLE_BUILDERS := QEMU -BUILDER_QEMU_EXE := qemu-system-$(ARCH) -BUILDER_QEMU_NAME := qemu -BUILDER_QEMU_PROV := $(BUILDER_QEMU_NAME) +AVAILABLE_BUILDERS := QEMU +BUILDER_QEMU_EXE := qemu-system-$(ARCH) +BUILDER_QEMU_NAME := qemu +BUILDER_QEMU_PROV := $(BUILDER_QEMU_NAME) -BUILDERS := qemu +BUILDERS := qemu -override BUILDER = qemu -override PROVISIONER = qemu +override BUILDER := qemu +override PROVISIONER := qemu # The packer templates, detected as *.json (excluding base.json) -TEMPLATES := $(patsubst %/,%,$(dir $(wildcard */base.pkrvars.hcl))) +TEMPLATES := $(patsubst %/,%,$(dir $(wildcard */base.pkrvars.hcl))) # The provisioning flavors, detected as ansible-<flavor>/setup-<flavor>.yml # Find all paths beginnig with "ansible-" and and save this suffix in PATTERNS -PATTERNS := $(patsubst ansible-%, %, $(wildcard ansible-*)) +PATTERNS := $(patsubst ansible-%, %, $(wildcard ansible-*)) # Extract <flavor> from ansible-<flavor>/setup-<flavor>.yml using PATTERNS as <flavor> -FLAVORS := $(foreach p, $(PATTERNS), \ - $(patsubst ansible-$(p)/setup-$(p).yml, $(p), \ - $(wildcard ansible-$(p)/setup-$(p).yml))) +FLAVORS := $(foreach p, $(PATTERNS), \ + $(patsubst ansible-$(p)/setup-$(p).yml, $(p), \ + $(wildcard ansible-$(p)/setup-$(p).yml))) # Extra flavor from variable ANSIBLE_DIR_PROV, using pattern ANSIBLE_DIR_PROV/setup-<flavor>.yml -FLAVORS += $(patsubst $(ANSIBLE_DIR_PROV)/setup-%.yml,%, \ - $(wildcard $(ANSIBLE_DIR_PROV)/setup-*.yml)) -FLAVORS := $(strip $(FLAVORS)) +FLAVORS += $(patsubst $(ANSIBLE_DIR_PROV)/setup-%.yml,%, \ + $(wildcard $(ANSIBLE_DIR_PROV)/setup-*.yml)) +FLAVORS := $(strip $(FLAVORS)) -BASETARGETS := $(strip $(foreach t, $(TEMPLATES), $(t)/base)) -PROVTARGETS := $(strip $(foreach t, $(TEMPLATES), \ - $(foreach f, $(FLAVORS), $(t)/$(f)))) -PROVIMAGES := $(strip $(foreach t, $(TEMPLATES), \ - $(foreach f, $(FLAVORS), $(t)/$(f): %/$(f): %/base))) -REPROVTARGETS := $(strip $(foreach t, $(TEMPLATES), \ - $(foreach f, $(FLAVORS), \ - $(filter-out $(t)/$(f).latest, \ - $(wildcard $(t)/$(f).*))))) -COMPRESSPOSSIBLE := $(foreach t, $(TEMPLATES), \ - $(foreach f, $(FLAVORS), $(wildcard $(t)/$(f).*))) -COMPRESSTARGETS := $(foreach p, $(COMPRESSPOSSIBLE), $(p)/compress) -BOOTTARGETS := $(foreach t, $(TEMPLATES), $(t)/base/boot) -BOOTTARGETS += $(foreach p, $(PROVTARGETS), $(p)/boot) -BOOTTARGETS := $(strip $(BOOTTARGETS)) -CURBOOTTARGETS := $(foreach p, $(REPROVTARGETS), $(p)/boot) -BASERMTARGETS := $(foreach t, $(BASETARGETS), rm/$(t)) -PROVRMTARGETS := $(foreach t, $(REPROVTARGETS), rm/$(t)) +BASETARGETS := $(strip $(foreach t, $(TEMPLATES), $(t)/base)) +PROVTARGETS := $(strip $(foreach t, $(TEMPLATES), \ + $(foreach f, $(FLAVORS), $(t)/$(f)))) +PROVIMAGES := $(strip $(foreach f, $(FLAVORS), \ + $(foreach t, $(TEMPLATES), $(t)/$(f): %/$(f): %/base))) +REPROVTARGETS := $(strip $(foreach t, $(TEMPLATES), \ + $(foreach f, $(FLAVORS), \ + $(filter-out $(t)/$(f).latest, \ + $(wildcard $(t)/$(f).*))))) +COMPRESSPOSSIBLE := $(foreach t, $(TEMPLATES), \ + $(foreach f, $(FLAVORS), $(wildcard $(t)/$(f).*))) +COMPRESSTARGETS := $(foreach p, $(COMPRESSPOSSIBLE), $(p)/compress) +BOOTTARGETS := $(foreach t, $(TEMPLATES), $(t)/base/boot) +BOOTTARGETS += $(foreach p, $(PROVTARGETS), $(p)/boot) +BOOTTARGETS := $(strip $(BOOTTARGETS)) +CURBOOTTARGETS := $(foreach p, $(REPROVTARGETS), $(p)/boot) +BASERMTARGETS := $(foreach t, $(BASETARGETS), rm/$(t)) +PROVRMTARGETS := $(foreach t, $(REPROVTARGETS), rm/$(t)) ifndef ANSIBLE_PROV_EXTRA_ARGS - ANSIBLE_PROV_EXTRA_ARGS := + ANSIBLE_PROV_EXTRA_ARGS := endif ifdef DEBUG - VERBOSE := 1 - ifeq ($(DEBUG),STEP) - override PACKER_OPTS += -debug - else - override PACKER_OPTS += -on-error=ask - endif + VERBOSE := 1 + ifeq ($(DEBUG),STEP) + override PACKER_OPTS += -debug + else + override PACKER_OPTS += -on-error=ask + endif endif ifdef FORCE - override PACKER_OPTS += -force + override PACKER_OPTS += -force endif ifdef WINDOW - override PACKER_OPTS += -var headless=false + override PACKER_OPTS += -var headless=false endif override PACKER_OPTS += -warn-on-undeclared-var @@ -84,24 +84,24 @@ override PACKER_OPTS += -warn-on-undeclared-var TIMESTAMP := $(shell date "+%Y-%m-%d_%H-%M-%S") ifdef VERBOSE - $(info timestamp: $(TIMESTAMP)) - $(info ) - $(info packer: executable: $(PACKER)) - $(info packer: options: $(PACKER_OPTS)) - $(info hasher: $(HASHER)) - $(info ) - $(info ansible: boot: $(ANSIBLE_DIR_BOOT)) - $(info ansible: flavors: $(FLAVORS)) - $(info ) - $(info builder: available: $(AVAILABLE_BUILDERS)) - $(info builder: chosen: $(BUILDER)) - $(info ) - $(info targets: base: $(BASETARGETS)) - $(info targets: boot: $(BOOTTARGETS)) - $(info targets: provision: $(PROVTARGETS)) - $(info targets: reprovision: $(REPROVTARGETS)) - $(info ) - override PACKER := PACKER_LOG=1 $(PACKER) + $(info timestamp: $(TIMESTAMP)) + $(info ) + $(info packer: executable: $(PACKER)) + $(info packer: options: $(PACKER_OPTS)) + $(info hasher: $(HASHER)) + $(info ) + $(info ansible: boot: $(ANSIBLE_DIR_BOOT)) + $(info ansible: flavors: $(FLAVORS)) + $(info ) + $(info builder: available: $(AVAILABLE_BUILDERS)) + $(info builder: chosen: $(BUILDER)) + $(info ) + $(info targets: base: $(BASETARGETS)) + $(info targets: boot: $(BOOTTARGETS)) + $(info targets: provision: $(PROVTARGETS)) + $(info targets: reprovision: $(REPROVTARGETS)) + $(info ) + override PACKER := PACKER_LOG=1 $(PACKER) endif .PHONY: help clean_except_last clean_bases clean_all clean_failed backinglock $(REPROVTARGETS) |