-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
105 lines (92 loc) · 2.32 KB
/
Taskfile.yml
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
---
version: "3"
vars:
CLUSTER: "{{.CLUSTER}}"
ENV: "{{.ENV}}"
CLUSTER_PATH: "{{.CLUSTER}}/{{.ENV}}"
CLUSTER_ROOT_DIR: "{{.ROOT_DIR}}/clusters/{{.CLUSTER}}"
KUBERNETES_DIR: "{{.CLUSTER_ROOT_DIR}}/{{.ENV}}"
ANSIBLE_DIR: "{{.ROOT_DIR}}/tools/ansible"
TERRAFORM_DIR: "{{.ROOT_DIR}}/terraform"
dotenv: [".config.env"]
env:
KUBECONFIG: "{{.ROOT_DIR}}/kubeconfig"
includes:
ansible: .taskfiles/AnsibleTasks.yml
cluster: .taskfiles/ClusterTasks.yml
precommit: .taskfiles/PrecommitTasks.yml
sops: .taskfiles/SopsTasks.yml
git: .taskfiles/GitTasks.yml
terraform: .taskfiles/TerraformTasks.yml
tasks:
init:
desc: Initialize workstation dependencies with Brew
cmds:
- brew install {{.DEPS}} {{.CLI_ARGS}}
- task ansible:init
preconditions:
- sh: command -v brew
msg: |
Homebrew is not installed. Using MacOS, Linux or WSL?
Head over to https://brew.sh to get up and running.
vars:
DEPS: >-
age
ansible
direnv
fluxcd/tap/flux
go-task/tap/go-task
helm
ipcalc
jq
kubernetes-cli
kustomize
pre-commit
prettier
sops
stern
terraform
tflint
weaveworks/tap/gitops
yamllint
yq
verify:
desc: Verify env settings
cmds:
- ./configure --verify
configure:
desc: Configure repository from env settings
cmds:
- ./configure
check:
desc: Checks the current context
cmds:
- "echo Cluster: {{.CLUSTER}}"
- "echo Environment: {{.ENV}}"
- "echo Cluster Directory: {{.KUBERNETES_DIR}}"
recreate:
desc: Recreates the cluster from scratch (nukes existing and creates new)
cmds:
- task: ansible:nuke
- sleep 5 & echo Cluster destroyed
- task: create
install:
desc: Installs Kubernetes
cmds:
- task: ansible:install
- export KUBECONFIG="{{.KUBERNETES_DIR}}/kubeconfig"
- kubectl get nodes
- task: cluster:verify
create:
desc: Creates the cluster
cmds:
- task: install
- task: cluster:install
sync:
desc: Commits and pushes all changes and then reconciles repository
cmds:
- task: git:push
- sleep 2
- task: cluster:reconcile
- sleep 5
- task: cluster:kustomizations