forked from wescale/hashistack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
150 lines (117 loc) · 4.81 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
separator = "********************************************************************************"
.PHONY: header
header:
@echo "*********************** WESCALE HASHISTACK MAKEFILE ****************************"
@echo "HOSTNAME `uname -n`"
@echo "KERNEL RELEASE `uname -r`"
@echo "KERNEL VERSION `uname -v`"
@echo "PROCESSOR `uname -m`"
@echo $(separator)
.PHONY: env
env-desc = "Build local workspace environment"
env: header
@echo ""
@echo $(env-desc)
@echo $(separator)
@pip3 install -U pip --no-cache-dir --quiet &&\
echo "[ OK ] PIP3" || \
echo "[FAILED] PIP3"
@pip3 install -U wheel --no-cache-dir --quiet &&\
echo "[ OK ] WHEEL" || \
echo "[FAILED] WHEEL"
@pip3 install -U setuptools --no-cache-dir --quiet &&\
echo "[ OK ] SETUPTOOLS" || \
echo "[FAILED] SETUPTOOLS"
@pip3 install -U --no-cache-dir --quiet -r ${PWD}/requirements.txt &&\
echo "[ OK ] REQUIREMENTS" || \
echo "[FAILED] REQUIREMENTS"
@pip3 install -U --no-cache-dir --quiet -r ${PWD}/docs/requirements.txt &&\
echo "[ OK ] DOC REQUIREMENTS" || \
echo "[FAILED] DOC REQUIREMENTS"
@echo ""
@echo "************************* IMPORT EXTERNAL ANSIBLE ROLES ************************"
ansible-galaxy collection install -fr requirements.yml
.PHONY: doc-desc
doc-desc = "Build project static html documentation"
doc:
@echo ""
@echo $(doc-desc)
@echo $(separator)
@cd docs && make html
@echo $(separator)
@echo "Static documentation exported:"
@echo " file://${PWD}/docs/build/html/index.html"
@echo $(separator)
.PHONY: clean-doc-desc
clean-doc-desc = "Clean project static html documentation"
clean-doc:
@echo ""
@echo $(clean-doc-desc)
@echo $(separator)
@cd docs && make clean
core_scw_terraform_servers: header
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/00_core_scw_servers.yml -e tf_action=apply
core_setup: header
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/00_core_setup_platform.yml && \
ansible-playbook playbooks/00_core_setup_controller.yml && \
ansible-playbook rtnp.galaxie_clans.gandi_delegate_subdomain -e scope=${HS_WORKSPACE}-controller -e gandi_subdomain=${HS_WORKSPACE}
letsencrypt:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/get_acme_certificate.yml
.PHONY: core_scw
core_scw: core_scw_terraform_servers core_setup letsencrypt
re-core: core
rm -f group_vars/${HS_WORKSPACE}_platform/tf_core.tmp.yml
.PHONY: core-destroy
core-destroy-desc = "Destroy current workspace environment"
core_scw_destroy:
@echo ""
@echo $(core-destroy-desc)
@echo $(separator)
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook rtnp.galaxie_clans.gandi_delegate_subdomain -e scope=${HS_WORKSPACE}-controller -e mode=destroy -e force=true && \
ansible-playbook playbooks/00_core_scw_servers.yml -e tf_action=destroy
install_vault:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/setup_vault.yml
vault_conf_destroy:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/tf_vault_config.yml -e tf_action=destroy
vault_conf_destroy_hardcore:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
rm -f group_vars/${HS_WORKSPACE}/secrets/tf_vault_config.yml && \
rm -rf group_vars/${HS_WORKSPACE}/terraform/vault_config
vault_conf:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/tf_vault_config.yml -e tf_action=apply
.PHONY: vault
vault: install_vault vault_conf
.PHONY: install_consul
install_consul:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/deploy_consul.yml
.PHONY: configure_consul
configure_consul:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/tf_consul_config.yml -e tf_action=apply
.PHONY: consul
consul: install_consul configure_consul
consul_conf_destroy_hardcore:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
rm -f group_vars/${HS_WORKSPACE}/secrets/tf_consul_config.yml && \
rm -rf group_vars/${HS_WORKSPACE}/terraform/consul_config
install_nomad:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/deploy_envoy.yml && \
ansible-playbook playbooks/deploy_nomad.yml
.PHONY: nomad
nomad: install_nomad
demo:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/tf_count_dashboard.yml -e tf_action=apply
demo-destroy:
[ -n "${HS_WORKSPACE}" ] || echo "Set the HS_WORKSPACE env variable" && \
ansible-playbook playbooks/tf_count_dashboard.yml -e tf_action=destroy
all: core vault consul nomad