Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
348 lines (322 loc) · 11.1 KB
/
Copy pathTaskfile.yml
File metadata and controls
348 lines (322 loc) · 11.1 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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
---
version: "3"
vars:
CONFIG_DIR: '{{ .CONFIG_DIR | default "config/examples" }}'
SCHEMA_DIR: '{{ .SCHEMA_DIR | default "config/schemas/v1" }}'
INVENTORY_FILE: '{{ .INVENTORY_FILE | default "tmp/ansible-inventory.json" }}'
OBSERVATION_DIR: '{{ .OBSERVATION_DIR | default "tmp/observed" }}'
SERVICE_OBSERVATION_DIR: '{{ .SERVICE_OBSERVATION_DIR | default "tmp/observed-services" }}'
DEPLOYMENT_DIR: '{{ .DEPLOYMENT_DIR | default "tmp/deployments" }}'
TIME_LIMIT: '{{ .TIME_LIMIT | default "cloudfall_servers" }}'
tasks:
validate:
desc: Validate the declarative Cloudfall config
cmds:
- uv run cloudfall config validate --project {{ .CONFIG_DIR }} --schemas {{ .SCHEMA_DIR }}
inventory:
desc: Render the validated config as Ansible JSON inventory
deps:
- validate
cmds:
- >-
uv run cloudfall-engine inventory render --project {{ .CONFIG_DIR }}
--schemas {{ .SCHEMA_DIR }} --output {{ .INVENTORY_FILE }}
ansible:inventory:
desc: Verify rendered inventory with Ansible
deps:
- inventory
cmds:
- uv run ansible-inventory --inventory {{ .INVENTORY_FILE }} --list
inspect:
desc: >-
Collect read-only server snapshots and rebuild the operations dashboard
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/inspect.yml
--extra-vars
cloudfall_inspect_output_directory={{ .ROOT_DIR }}/{{ .OBSERVATION_DIR }}
- >-
uv run cloudfall dashboard build --project {{ .CONFIG_DIR }}
--schemas {{ .SCHEMA_DIR }} --observed {{ .OBSERVATION_DIR }}
--output-dir {{ .ROOT_DIR }}/tmp/dashboard
audit:
desc: Compare the config with previously collected observations
deps:
- validate
cmds:
- >-
uv run cloudfall audit --project {{ .CONFIG_DIR }} --schemas {{ .SCHEMA_DIR }}
--observed {{ .OBSERVATION_DIR }}
services:inspect:
desc: Collect DNS, TLS, origin, and public service evidence
deps:
- validate
cmds:
- >-
uv run cloudfall services observe --project {{ .CONFIG_DIR }}
--schemas {{ .SCHEMA_DIR }} --service-observed {{ .SERVICE_OBSERVATION_DIR }}
services:status:
desc: Show evidence-derived service lifecycle status
deps:
- validate
cmds:
- >-
uv run cloudfall services status --project {{ .CONFIG_DIR }}
--schemas {{ .SCHEMA_DIR }} --observed {{ .OBSERVATION_DIR }}
--service-observed {{ .SERVICE_OBSERVATION_DIR }}
--deployments {{ .DEPLOYMENT_DIR }}
server:baseline:check:
desc: Check the server baseline convergence without changing hosts
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --check --diff
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/baseline.yml
server:baseline:
desc: Converge servers to the managed baseline
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/baseline.yml
services:deploy:check:
desc: Check declared infrastructure services without changing hosts
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --check --diff
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/services.yml
services:deploy:
desc: Converge declared infrastructure services
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/services.yml
artifact:build:
desc: Build a release artifact for COMPONENT at git REF
deps:
- validate
preconditions:
- sh: test -n "{{ .COMPONENT }}"
msg: Set COMPONENT to the component id to build
- sh: test -n "{{ .REF }}"
msg: Set REF to the git branch, tag, or commit to package
cmds:
- >-
uv run cloudfall-engine artifact build --project {{ .CONFIG_DIR }}
{{ .COMPONENT }} --ref {{ .REF }} --schemas {{ .SCHEMA_DIR }}
--output-dir {{ .ARTIFACT_DIR | default "tmp/artifacts" }}
deploy:
desc: Deploy COMPONENT at RELEASE with a health-gated switch
preconditions:
- sh: test -n "{{ .COMPONENT }}"
msg: Set COMPONENT to the component id to deploy
- sh: test -n "{{ .RELEASE }}"
msg: Set RELEASE to a release id produced by artifact:build
cmds:
- >-
uv run cloudfall deploy --project {{ .CONFIG_DIR }} {{ .COMPONENT }}
--release {{ .RELEASE }} --schemas {{ .SCHEMA_DIR }}
--artifacts {{ .ARTIFACT_DIR | default "tmp/artifacts" }}
--releases {{ .ROOT_DIR }}/tmp/releases
{{ if .ENV_FILE }}--env-file {{ .ENV_FILE }}{{ end }} --yes
rollback:
desc: Roll COMPONENT back to an existing RELEASE
preconditions:
- sh: test -n "{{ .COMPONENT }}"
msg: Set COMPONENT to the component id to roll back
- sh: test -n "{{ .RELEASE }}"
msg: Set RELEASE to an existing release id on the servers
cmds:
- >-
uv run cloudfall rollback --project {{ .CONFIG_DIR }} {{ .COMPONENT }}
--release {{ .RELEASE }} --schemas {{ .SCHEMA_DIR }} --yes
restart:
desc: Restart COMPONENT behind its declared health check
preconditions:
- sh: test -n "{{ .COMPONENT }}"
msg: Set COMPONENT to the component id to restart
cmds:
- >-
uv run cloudfall restart --project {{ .CONFIG_DIR }} {{ .COMPONENT }}
--schemas {{ .SCHEMA_DIR }} --yes
health:
desc: Probe COMPONENT's declared health check
preconditions:
- sh: test -n "{{ .COMPONENT }}"
msg: Set COMPONENT to the component id to probe
cmds:
- >-
uv run cloudfall health --project {{ .CONFIG_DIR }} {{ .COMPONENT }}
--schemas {{ .SCHEMA_DIR }}
domains:deploy:check:
desc: Check declared domain routes without changing hosts
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --check --diff
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/domains.yml
domains:deploy:
desc: Converge declared domain routes and write deployment receipts
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --inventory {{ .INVENTORY_FILE }}
--extra-vars
cloudfall_domains_receipt_directory={{ .ROOT_DIR }}/{{ .DEPLOYMENT_DIR }}
--extra-vars
cloudfall_domains_issue_certificates={{ .ISSUE_CERTIFICATES | default "false" }}
engine/ansible/playbooks/domains.yml
logging:check:
desc: Check the guarded parallel logging deployment without applying it
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --check --diff
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/logging.yml
logging:deploy:
desc: Deploy Loki, Grafana, and Alloy without changing legacy log agents
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/logging.yml
time:check:
desc: Check the UTC time baseline without changing servers
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --check --diff
--limit {{ .TIME_LIMIT }}
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/time.yml
time:deploy:
desc: Enforce UTC and synchronized time on selected servers
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook
--limit {{ .TIME_LIMIT }}
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/time.yml
dashboard:
desc: Build the local read-only operations dashboard
deps:
- validate
cmds:
- >-
uv run cloudfall dashboard build --project {{ .CONFIG_DIR }}
--schemas {{ .SCHEMA_DIR }} --observed {{ .OBSERVATION_DIR }}
--service-observed {{ .SERVICE_OBSERVATION_DIR }}
--deployments {{ .DEPLOYMENT_DIR }}
--output-dir {{ .ROOT_DIR }}/tmp/dashboard
dashboard:serve:
desc: Serve the live-refreshing read-only operations dashboard over HTTP
deps:
- validate
cmds:
- >-
uv run cloudfall dashboard serve --project {{ .CONFIG_DIR }}
--schemas {{ .SCHEMA_DIR }} --observed {{ .OBSERVATION_DIR }}
--service-observed {{ .SERVICE_OBSERVATION_DIR }}
--deployments {{ .DEPLOYMENT_DIR }}
--host {{ .DASHBOARD_HOST | default "127.0.0.1" }}
--port {{ .DASHBOARD_PORT | default "8100" }}
--refresh {{ .DASHBOARD_REFRESH | default "10" }}
--inspect-services
ansible:syntax:
desc: Run Ansible syntax and lint checks
deps:
- inventory
env:
ANSIBLE_CONFIG: engine/ansible/ansible.cfg
cmds:
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/bootstrap.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/data.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/inspect.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/baseline.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/services.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/deploy.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/rollback.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/restart.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/health.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/domains.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/logging.yml
- >-
uv run ansible-playbook --syntax-check
--inventory {{ .INVENTORY_FILE }}
engine/ansible/playbooks/time.yml
- uv run ansible-lint engine/ansible