I :=	inventory		# inventory file
L :=	"$(shell hostname -s)"	# host limit
C :=	-c local		# connection
K :=	-K			# prompt for sudo password
O :=				# additional options
P :=	site.yml		# playbook
T :=				# if y, time the process
V :=				# verbosity
# V :=	-vvv			# verbosity


ifeq ($T,y)
	TIME = /usr/bin/time -v
else
	TIME =
endif

all: deploy

print-%: ; @echo '$(subst ','\'',$*=$($*))'

check:
	$(TIME) ansible-playbook -i $I -l $L $C $K --syntax-check $V $O $P

deploy:
	$(TIME) ansible-playbook -i $I -l $L $C $K $V $O $P

.PHONY: all check deploy
