infrastructure/Makefile

66 lines
1.3 KiB
Makefile
Raw Normal View History

2024-09-24 23:10:59 +00:00
SHELL := /bin/bash
2024-10-13 16:30:14 +00:00
TAGS ?= all
2024-09-24 23:10:59 +00:00
include .env
export
2024-10-03 01:46:55 +00:00
PWD := $(shell pwd)
2024-09-24 23:10:59 +00:00
2024-10-03 01:46:55 +00:00
.FORCE:
./inventory/group_vars/all/all_services.yml: .FORCE
tofu output --json services \
| yq -y '{all_services: .}' \
> ./inventory/group_vars/all/all_services.yml
2024-10-06 17:08:13 +00:00
./inventory/group_vars/all/opentofu.yml: .FORCE
2024-10-06 17:08:13 +00:00
tofu output --json \
| yq -y '{opentofu: with_entries(.value |= .value)}' \
> ./inventory/group_vars/all/opentofu.yml
2024-10-06 17:08:13 +00:00
2024-10-03 01:46:55 +00:00
./dns/hosts.json: .FORCE
2024-10-22 15:44:00 +00:00
tofu output --json hosts \
2024-10-03 01:46:55 +00:00
> ./dns/hosts.json
./dns/services.json: ./inventory/group_vars/all/all_services.yml
2024-10-03 01:46:55 +00:00
ansible-playbook \
-e services_json_file=$(PWD)/dns/services.json \
playbooks/create_services_for_dnscontrol.yml
2024-09-24 23:10:59 +00:00
2024-10-22 15:44:00 +00:00
./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
2024-09-24 23:10:59 +00:00
2024-10-22 15:44:00 +00:00
output-ansible: ./inventory/group_vars/all/opentofu.yml
2024-09-24 23:10:59 +00:00
2024-10-22 15:44:00 +00:00
output: output-dns output-ansible
2024-09-24 23:10:59 +00:00
./types-dnscontrol.d.ts:
dnscontrol write-types
tofu:
tofu apply
2024-10-06 17:08:13 +00:00
@printf "\n=====\n\n"
$(MAKE) output
2024-10-22 15:44:00 +00:00
dns: output-dns
2024-09-24 23:10:59 +00:00
dnscontrol push
2024-10-22 15:44:00 +00:00
dns-check: output-dns
2024-09-24 23:10:59 +00:00
dnscontrol check-creds ovh
2024-10-07 19:17:35 +00:00
all:
$(MAKE) tofu
$(MAKE) dns
@printf "\n=====\n\n"
2024-10-19 13:18:54 +00:00
ansible-playbook ./playbooks/stop-and-backup-unused.yml -t $(TAGS)
2024-10-13 16:30:14 +00:00
ansible-playbook ./playbooks/serguzim.net.yml -t $(TAGS)
2024-10-14 15:49:44 +00:00
visualize:
./visualize.py | d2 - infrastructure.svg
2024-10-14 15:49:44 +00:00