infrastructure/Makefile

65 lines
1.3 KiB
Makefile

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