ansible/Makefile

29 lines
553 B
Makefile
Raw Permalink Normal View History

2023-04-11 20:24:55 +00:00
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
2023-04-12 06:13:11 +00:00
T := # if y, time the process
2023-04-13 02:24:13 +00:00
V := # verbosity
# V := -vvv # verbosity
2023-04-11 02:55:24 +00:00
2023-04-12 06:13:11 +00:00
ifeq ($T,y)
TIME = /usr/bin/time -v
else
TIME =
endif
2023-04-11 02:55:24 +00:00
all: deploy
2023-04-12 06:13:11 +00:00
print-%: ; @echo '$(subst ','\'',$*=$($*))'
2023-04-11 02:55:24 +00:00
check:
2023-04-12 06:13:11 +00:00
$(TIME) ansible-playbook -i $I -l $L $C $K --syntax-check $V $O $P
2023-04-11 02:55:24 +00:00
deploy:
2023-04-12 06:13:11 +00:00
$(TIME) ansible-playbook -i $I -l $L $C $K $V $O $P
2023-04-11 02:55:24 +00:00
.PHONY: all check deploy