-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
31 lines (21 loc) · 836 Bytes
/
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
TERRAFORM = terraform
PREPARE = $(TERRAFORM) init
APPLY = $(TERRAFORM) apply
UPDATE = $(PREPARE) -upgrade
DESTROY = $(TERRAFORM) destroy
all: ask terraform ansible
update:
$(UPDATE) && $(APPLY) -auto-approve
stop:
$(DESTROY) -auto-approve
ask:
@clear && \
echo "How many worker node would you like to create?"
terraform:
$(PREPARE) && $(APPLY) -auto-approve -var="worker_count=$(shell read worker_count && echo $$worker_count)" && terraform output -raw instance_ids > ansible/inventory.ini
output:
terraform output -raw instance_ids > ansible/inventory.ini
ansible:
cd ansible/ && ansible-playbook -i inventory.ini main.yml --private-key /home/kaan/myComputer.pem --ssh-extra-args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
re: stop start
.PHONY: all start stop output update update-apply re ansible