infrastructure/justfile

61 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2023-06-18 17:13:31 +01:00
export PATH := justfile_directory() + "/env/bin:" + env_var("PATH")
# Recipes
@default:
just --list
ansible-setup: ansible-install ansible-galaxy-install
ansible-install:
2023-06-18 17:13:31 +01:00
python -m venv env
pip install -r ansible/dev-requirements.txt
ansible-galaxy-install: ansible-install
2023-06-18 17:13:31 +01:00
cd ansible/ && ansible-galaxy install -r galaxy-requirements.yml --force
2024-07-14 21:25:10 +01:00
@ansible-facts HOST:
cd ansible/ && ansible -m setup {{ HOST }} --vault-password-file=vault-pass.sh
2023-06-18 17:13:31 +01:00
# Run terraform with required environment
terraform +ARGS:
#!/usr/bin/env bash
cd terraform/
# Load secrets from env file (if it exists)
set -a
source ./.env || true
set +a
terraform {{ ARGS }}
# Download secrets
update-secrets:
2024-09-01 20:53:31 +01:00
bw sync
2023-06-18 17:13:31 +01:00
cd terraform/ && bw get attachment .env --itemid c4f8b44e-ae62-442d-a9e0-02d0621c2454
ansible-deploy *ARGS: ansible-galaxy-install
2023-11-08 19:46:28 +00:00
cd ansible/ && ansible-playbook main.yml --vault-password-file=vault-pass.sh -K --diff {{ ARGS }}
2023-06-18 17:13:31 +01:00
2024-11-03 14:21:49 +00:00
ansible-deploy-fast *ARGS:
cd ansible/ && ansible-playbook main.yml --vault-password-file=vault-pass.sh -K --diff {{ ARGS }}
2023-08-31 09:21:14 +01:00
ansible-vault ACTION *ARGS:
cd ansible/ && ansible-vault {{ ACTION }} --vault-password-file=vault-pass.sh {{ ARGS }}
2023-06-18 17:13:31 +01:00
terraform-lint:
just terraform validate
just terraform fmt -check -recursive
yamllint:
yamllint -s .
ansible-lint: yamllint
#!/usr/bin/env bash
cd ansible/
ansible-lint -p
ansible-playbook main.yml --syntax-check
lint: terraform-lint ansible-lint