-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
68 lines (56 loc) · 1.91 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
66
67
68
IMG_NAME=ntc-jv/ansible
IMG_VERSION=1.1.0
.DEFAULT_GOAL := test
.PHONY: test
test: lint unit
.PHONY: build
build:
docker build -t $(IMG_NAME):$(IMG_VERSION) .
.PHONY: cli
cli:
docker run -it --env-file=.env \
-v $(shell pwd):/local \
-w /local \
$(IMG_NAME):$(IMG_VERSION) bash
.PHONY: pylint
pylint:
find ./ -name "*.py" | xargs pylint
.PHONY: lint
lint:
@echo "Starting lint"
docker run -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) yamllint --strict .
# docker run -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) ansible-lint .
docker run -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) make pylint
docker run -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) black --check .
docker run -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) bandit --recursive --config .bandit.yml ./
@echo "Completed lint"
.PHONY: unit
unit:
@echo "Starting unit tests"
docker run -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) pytest -vv
docker run -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) ansible-playbook tests/pb.unittest.yml
@echo "Completed unit tests"
.PHONY: unit-pytest
unit-pytest:
@echo "Starting unit tests"
docker run -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) pytest -vv
@echo "Completed unit tests"
.PHONY: unit-ansible
unit-ansible:
@echo "Starting unit tests"
docker run -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) ansible-playbook tests/pb.unittest.yml
@echo "Completed unit tests"
.PHONY: demo_show_setup
demo_show_setup:
@echo "Starting the Setup demo"
docker run -e "TERM=xterm-256color" -v $(shell pwd):/local $(IMG_NAME):$(IMG_VERSION) ansible-playbook setup_nautobot.yml --limit rtr-1
.PHONY: demo_setup
demo_setup:
@echo "Starting the Setup demo"
ansible-playbook setup_nautobot.yml --tags ios
.PHONY: demo_audit
demo_audit:
@echo "Starting Audit of single device"
ansible-playbook audit_nautobot.yml --limit wanrtr01
read
ansible-playbook audit_nautobot.yml