-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (40 loc) · 1.22 KB
/
Makefile
File metadata and controls
50 lines (40 loc) · 1.22 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
.DEFAULT_GOAL := help
.PHONY: help
all: test vagrant_halt clean
## Run tests on any file change
watch: test_deps
while sleep 1; do \
find defaults/ meta/ tasks/ templates/ tests/test.yml tests/vagrant/Vagrantfile \
| entr -d make lint vagrant; \
done
## Run tests
test: test_deps lint vagrant
## Install test dependencies
test_deps:
rm -rf tests/sansible.*
ln -s .. tests/sansible.users_and_groups
## Start and (re)provisiom Vagrant test box
vagrant:
cd tests/vagrant && vagrant up --no-provision
cd tests/vagrant && vagrant provision
## Execute simple Vagrant command
# Example: make vagrant_ssh
# make vagrant_halt
vagrant_%:
cd tests/vagrant && vagrant $(subst vagrant_,,$@)
## Lint role
# You need to install ansible-lint
lint:
find defaults/ meta/ tasks/ templates/ -name "*.yml" | xargs -I{} ansible-lint {}
## Clean up
clean:
rm -rf tests/sansible.*
cd tests/vagrant && vagrant destroy
## Prints this help
help:
@awk -v skip=1 \
'/^##/ { sub(/^[#[:blank:]]*/, "", $$0); doc_h=$$0; doc=""; skip=0; next } \
skip { next } \
/^#/ { doc=doc "\n" substr($$0, 2); next } \
/:/ { sub(/:.*/, "", $$0); printf "\033[34m%-30s\033[0m\033[1m%s\033[0m %s\n\n", $$0, doc_h, doc; skip=1 }' \
$(MAKEFILE_LIST)