infrastructure/Makefile
Tobias Reisinger 4104057771
Fix pre-commit hooks and move directories
roles/ and inventory/ are now in playbooks/
also fixed issues reported by ansible-lint
2024-10-14 18:31:36 +02:00

61 lines
1.4 KiB
Makefile

SHELL := /bin/bash
TAGS ?= all
include .env
export
PWD := $(shell pwd)
.FORCE:
./playbooks/inventory/group_vars/all/all_services.yml: .FORCE
tofu output --json \
| yq -y '{all_services: with_entries(.value |= .value).services | to_entries | map(.value)}' \
> ./playbooks/inventory/group_vars/all/all_services.yml
./playbooks/inventory/group_vars/all/opentofu.yml: .FORCE
tofu output --json \
| yq -y '{opentofu: with_entries(.value |= .value)}' \
> ./playbooks/inventory/group_vars/all/opentofu.yml
./dns/hosts.json: .FORCE
tofu output --json \
| jq 'with_entries(.value |= .value).hosts' \
> ./dns/hosts.json
./dns/services.json: ./playbooks/inventory/group_vars/all/all_services.yml
ansible-playbook \
-e services_json_file=$(PWD)/dns/services.json \
playbooks/create_services_for_dnscontrol.yml
output: ./dns/hosts.json ./dns/services.json ./playbooks/inventory/group_vars/all/opentofu.yml
./types-dnscontrol.d.ts:
dnscontrol write-types
tofu:
tofu apply
@printf "\n=====\n\n"
$(MAKE) output
dns: ./types-dnscontrol.d.ts ./dns/hosts.json ./dns/services.json
dnscontrol push
dns-check: ./types-dnscontrol.d.ts ./dns/hosts.json ./dns/services.json
dnscontrol check-creds ovh
all:
$(MAKE) tofu
$(MAKE) dns
@printf "\n=====\n\n"
ansible-playbook ./playbooks/serguzim.net.yml -t $(TAGS)
visualize:
tofu output --json \
| jq 'with_entries(.value |= .value)' \
| ./visualize.py \
| d2 - infrastructure.svg