-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
108 lines (97 loc) · 3.27 KB
/
Copy pathmakefile
File metadata and controls
108 lines (97 loc) · 3.27 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
SHELL := /bin/bash
REQUIRED_ENV_VARS := AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
preflight_checks:
@python3 -m pip install --no-cache-dir -r scripts/requirements.txt
@python3 ./scripts/preflight-checks.py
render_templates:
@python3 scripts/render.py
terraform_apply:
@terraform -chdir=terraform init
@terraform -chdir=terraform plan -out=terraform.tfplan
@terraform -chdir=terraform apply terraform.tfplan
terraform_plan:
@terraform -chdir=terraform init
@terraform -chdir=terraform plan
ansible_setup:
@ansible-galaxy install -r ansible/requirements.yaml --force
@ansible-playbook ansible/bootstrap.yaml -i ansible/inventory.yaml
terraform_destroy:
@terraform -chdir=terraform destroy $(AUTO_APPROVE)
build:
@podman run --rm -it \
-v $(shell pwd)/:/usr/src/app:z \
-w /usr/src/app \
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
-e CLUSTER_USERNAME=${CLUSTER_USERNAME} \
-e CLUSTER_PASSWORD=$(CLUSTER_PASSWORD) \
-e ROSA_TOKEN=${ROSA_TOKEN} \
-e VAULT_TOKEN=${VAULT_TOKEN} \
docker.io/cengleby86/bootstrapper:latest \
bash -c "\
j2 --format=env config.yaml > vars.yaml \
&& echo -e '\\nJinja2 template rendered\\n' \
&& make preflight_checks \
&& make render_templates \
&& make terraform_apply \
"
plan:
@podman run --rm -it \
-v $(shell pwd)/:/usr/src/app:z \
-w /usr/src/app \
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
-e CLUSTER_USERNAME=${CLUSTER_USERNAME} \
-e CLUSTER_PASSWORD=$(CLUSTER_PASSWORD) \
-e ROSA_TOKEN=${ROSA_TOKEN} \
-e VAULT_TOKEN=${VAULT_TOKEN} \
docker.io/cengleby86/bootstrapper:latest \
bash -c "\
j2 --format=env config.yaml > vars.yaml \
&& echo -e '\\nJinja2 template rendered\\n' \
&& make preflight_checks \
&& make render_templates \
&& make terraform_plan \
"
configure:
@podman run --rm -it \
-v $(shell pwd)/:/usr/src/app:z \
-w /usr/src/app \
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
-e CLUSTER_USERNAME=${CLUSTER_USERNAME} \
-e CLUSTER_PASSWORD=$(CLUSTER_PASSWORD) \
-e ROSA_TOKEN=${ROSA_TOKEN} \
-e VAULT_TOKEN=${VAULT_TOKEN} \
docker.io/cengleby86/bootstrapper:latest \
bash -c "\
j2 --format=env config.yaml > vars.yaml \
&& echo -e '\\nJinja2 template rendered\\n' \
&& make preflight_checks \
&& make ansible_setup \
"
cleanup:
@podman run --rm -it \
-v $(shell pwd)/:/usr/src/app:z \
-w /usr/src/app \
-e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
-e CLUSTER_USERNAME=${CLUSTER_USERNAME} \
-e CLUSTER_PASSWORD=$(CLUSTER_PASSWORD) \
-e ROSA_TOKEN=${ROSA_TOKEN} \
-e VAULT_TOKEN=${VAULT_TOKEN} \
docker.io/cengleby86/bootstrapper:latest \
bash -c "\
j2 --format=env config.yaml > vars.yaml \
&& echo -e '\\nJinja2 template rendered\\n' \
&& make preflight_checks \
&& make render_templates \
&& make terraform_destroy AUTO_APPROVE="-auto-approve" \
"
help:
@echo "Usage: make [target]"
@echo
@echo "Available targets:"
@echo " build Builds an OpenShift Cluster."
@echo " configure Configures the Cluster and Deploys a workshop."
@echo " cleanup Destroys an OpenShift Cluster."