Update make targets

Add all and clean

Also removes prompts during make
This commit is contained in:
IamTheFij 2022-11-27 22:44:55 -08:00
parent fc86b974a7
commit b9aec2a3c4

View File

@ -3,6 +3,9 @@ VENV ?= venv
.PHONY: default .PHONY: default
default: check default: check
.PHONY: all
all: cluster bootstrap-values apply
.PHONY: cluster .PHONY: cluster
cluster: ansible-cluster cluster: ansible-cluster
@ -46,7 +49,7 @@ ansible_galaxy/roles: $(VENV) ./ansible_galaxy/requirements.yml
.PHONY: ansible-cluster .PHONY: ansible-cluster
ansible-cluster: $(VENV) ansible_galaxy ansible-cluster: $(VENV) ansible_galaxy
env VIRTUAL_ENV=$(VENV) $(VENV)/bin/ansible-playbook -K -vv \ env VIRTUAL_ENV=$(VENV) $(VENV)/bin/ansible-playbook -vv \
$(shell test -f vault-keys.json && echo '-e "@vault-keys.json"') \ $(shell test -f vault-keys.json && echo '-e "@vault-keys.json"') \
./ansible_playbooks/setup-cluster.yml ./ansible_playbooks/setup-cluster.yml
@ -75,5 +78,13 @@ plan:
.PHONY: apply .PHONY: apply
apply: apply:
@terraform apply \ @terraform apply \
-auto-approve \
-var "nomad_secret_id=$(shell jq -r .SecretID nomad_bootstrap.json)" \ -var "nomad_secret_id=$(shell jq -r .SecretID nomad_bootstrap.json)" \
-var "vault_token=$(shell jq -r .root_token vault-keys.json)" -var "vault_token=$(shell jq -r .root_token vault-keys.json)"
.PHONY: clean
clean:
env VIRTUAL_ENV=$(VENV) $(VENV)/bin/ansible-playbook -vv \
./ansible_playbooks/clear-data.yml
find -name "*.tfstate" -exec rm '{}' \;
rm -f ./vault-keys.json ./nomad_bootstrap.json