/
Makefile
65 lines (52 loc) · 1.34 KB
/
Makefile
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
export PIPENV_VENV_IN_PROJECT := true
export ANSIBLE_ROLES_PATH := ${PWD}/..
define hr
@printf '%.s─' $$(seq 1 $$(tput cols))
endef
all: install security test
install:
$(call hr)
@command -v python3 2>&1 >/dev/null || echo "Please install python3!"
@command -v pipenv 2>&1 >/dev/null || pip3 install pipenv
@which pip3 | grep -q 'shim' && asdf reshim python || true
@pipenv install --dev
@pipenv run pre-commit install \
--hook-type pre-commit \
--hook-type commit-msg \
--hook-type pre-push
## remove our pipenv environment
clean:
$(call hr)
@pipenv --rm
## only run the linter, no testing
lint:
$(call hr)
@pipenv run molecule lint
## molecule test already does linting
test:
$(call hr)
@pipenv run molecule test --all
## Update pipenv dependencies along with pre-commit
update:
$(call hr)
@pipenv update --dev
@pipenv run pre-commit autoupdate
## Test for known vulnerabilities in our pipenv environment
security:
$(call hr)
@pipenv check
## Spin up a molecule instance
create:
@pipenv run molecule create
## Converge the role
converge: create
$(call hr)
@pipenv run molecule converge
## Destroy the instance
destroy:
@pipenv run molecule destroy
## Run the role on localhost
run:
$(call hr)
@ansible-playbook -v tests/test.yml -i tests/inventory
.PHONY: all install lint test update clean security converge destroy run