Infrastructure-as-Code/debian/Makefile

39 lines
1.0 KiB
Makefile

default:
terraform plan --out=plan
terraform apply plan
inventory: ## Deploy server
terraform plan --out=plan
terraform apply plan
configure: ## Configure server
ansible-playbook -i ./ansible/inventory/hosts.ini -f 10 ./ansible/playbook.yml
ansible-check: ## Check Ansible playbooks
ansible-playbook --check ./ansible/playbook.yml
lint: ## Lint source code
terraform fmt
ansible-lint --write ./ansible/playbook.yml
ansible-lint --write ./ansible/shutdown.yml
. ./venv/bin/activate && black tests/
on: ## Power on VMs
./scripts/on.sh
virsh list
shutdown: ## Shut down vms
ansible-playbook -i ./ansible/inventory/hosts.ini -f 10 ./ansible/shutdown.yml
test: ## Test VM configuration
. ./venv/bin/activate && \
cd tests/ && \
py.test --hosts='ansible://all' \
-n 10 \
--verbose \
--ansible-inventory='../ansible/inventory/hosts.ini'
help: ## Prints help for targets with comments
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'