VENV     := .venv
ANSIBLE  := $(VENV)/bin/ansible
PLAYBOOK := $(VENV)/bin/ansible-playbook
GALAXY   := $(VENV)/bin/ansible-galaxy
INV      := ansible/inventory.yml

.PHONY: install ping check apply apply-storage apply-gpu vault-init

install:
	$(VENV)/bin/pip install -q -r requirements.txt
	$(GALAXY) collection install -r ansible/requirements.yml

ping:
	cd ansible && ../$(ANSIBLE) all -m ping

check:
	cd ansible && ../$(PLAYBOOK) playbooks/site.yml --check

apply:
	cd ansible && ../$(PLAYBOOK) playbooks/site.yml

apply-storage:
	cd ansible && ../$(PLAYBOOK) playbooks/storage-01.yml

apply-gpu:
	cd ansible && ../$(PLAYBOOK) playbooks/gpu-01.yml

vault-encrypt:
	cd ansible && ../$(VENV)/bin/ansible-vault encrypt group_vars/all/vault.yml

vault-edit:
	cd ansible && ../$(VENV)/bin/ansible-vault edit group_vars/all/vault.yml

vault-view:
	cd ansible && ../$(VENV)/bin/ansible-vault view group_vars/all/vault.yml
