-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
75 lines (58 loc) · 1.63 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
69
70
71
72
73
74
75
VENV_DIR := .venv
ACTIVATE := . ${VENV_DIR}/bin/activate
ANSIBLE_NAVIGATOR := true
HOST := kube-0
UPDATE_MANIFESTS := "false"
PIP := ${ACTIVATE}; pip
ifdef $(ANSIBLE_NAVIGATOR)
PLAYBOOK := ${ACTIVATE}; ansible-navigator run -i inventory/hosts.yaml site.yaml
else
PLAYBOOK := ${ACTIVATE}; ansible-playbook -i inventory/hosts.yaml site.yaml
endif
plan: ${HOST}
${HOST}: prerun
@echo "Planning cluster..."
@${PLAYBOOK} -e 'lifecycle="create"' --check --diff
@echo "Done."
prerun:
@echo "Running pre-run tasks..."
@op user get --me
@echo "Done."
etcd: prerun
@echo "Installing etcd..."
@./scripts/etcd.sh
@echo "Done."
install: prerun
@echo "Installing cluster..."
@${PLAYBOOK} -e 'lifecycle="create" self_managed="true" update_manifests="true" install_dependencies="false"'
@echo "Done."
cleanup: prerun
@echo "Installing cluster..."
@${PLAYBOOK} -e 'lifecycle="cleanup" self_managed="true" install_dependencies="false"'
@echo "Done."
install-nav: prerun
@echo "Installing cluster..."
@./scripts/create.sh -n
@echo "Done."
update: prerun
@echo "Updating cluster..."
@./scripts/update.sh .venv
@echo "Done."
delete: prerun
@echo "Uninstalling cluster..."
@${PLAYBOOK} -e 'lifecycle="delete"'
@echo "Done."
debug: prerun
@echo "Installing cluster..."
@${PLAYBOOK} --tags "syntax"
@echo "Done."
${VENV_DIR}:
@echo "Creating virtual environment..."
@python3 -m venv ${VENV_DIR}
configure-venv: ${VENV_DIR}
@echo "Installing dependencies..."
@${PIP} install -r requirements.txt
@${ACTIVATE}; ansible-galaxy collection install -r requirements.yaml
@echo "Done."
.PHONY: install configure-venv update
.DEFAULT_GOAL := install