-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (36 loc) · 1.07 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
# Variables
ANSIBLE_PLAYBOOK := ansible-playbook
ANSIBLE_GALAXY := ansible-galaxy
TERRAFORM := terraform
TERRAFORM_DIR := servers/arctic/terraform
ANSIBLE_DIR := ansible
# Terraform Commands
tf-init:
cd $(TERRAFORM_DIR) && $(TERRAFORM) init
tf-plan:
cd $(TERRAFORM_DIR) && $(TERRAFORM) plan
tf-apply:
cd $(TERRAFORM_DIR) && $(TERRAFORM) apply -auto-approve
tf-destroy:
cd $(TERRAFORM_DIR) && $(TERRAFORM) destroy -auto-approve
tf-clean:
rm -rf $(TERRAFORM_DIR)/.terraform
rm -f $(TERRAFORM_DIR)/terraform.tfstate*
# Ansible Commands
arctic:
cd $(ANSIBLE_DIR) && $(ANSIBLE_PLAYBOOK) arctic.yml
grey:
cd $(ANSIBLE_DIR) && $(ANSIBLE_PLAYBOOK) grey.yml
arctic-t:
cd $(ANSIBLE_DIR) && $(ANSIBLE_PLAYBOOK) arctic.yml --tags terraform
grey-t:
cd $(ANSIBLE_DIR) && $(ANSIBLE_PLAYBOOK) grey.yml --tags terraform
galaxy:
$(ANSIBLE_GALAXY) install -r ansible/requirements.yml
vault:
cd $(ANSIBLE_DIR) && ansible-vault view vars/secrets.yml
vault-edit:
cd $(ANSIBLE_DIR) && ansible-vault edit vars/secrets.yml
# Combined Tasks
setup: galaxy playbook
infra: tf-init tf-plan tf-apply