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:
|
|
|
|
|
2024-10-17 23:34:55 +00:00
|
|
|
./inventory/group_vars/all/all_services.yml: .FORCE
|
2024-10-06 17:08:13 +00:00
|
|
|
tofu output --json \
|
|
|
|
| yq -y '{all_services: with_entries(.value |= .value).services | to_entries | map(.value)}' \
|
2024-10-17 23:34:55 +00:00
|
|
|
> ./inventory/group_vars/all/all_services.yml
|
2024-10-06 17:08:13 +00:00
|
|
|
|
2024-10-17 23:34:55 +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)}' \
|
2024-10-17 23:34:55 +00:00
|
|
|
> ./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-09-26 22:02:36 +00:00
|
|
|
tofu output --json \
|
2024-09-24 23:10:59 +00:00
|
|
|
| jq 'with_entries(.value |= .value).hosts' \
|
2024-10-03 01:46:55 +00:00
|
|
|
> ./dns/hosts.json
|
|
|
|
|
2024-10-17 23:34:55 +00:00
|
|
|
./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-17 23:34:55 +00:00
|
|
|
output: ./dns/hosts.json ./dns/services.json ./inventory/group_vars/all/opentofu.yml
|
2024-09-24 23:10:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
./types-dnscontrol.d.ts:
|
|
|
|
dnscontrol write-types
|
|
|
|
|
2024-10-06 15:08:25 +00:00
|
|
|
tofu:
|
|
|
|
tofu apply
|
2024-10-06 17:08:13 +00:00
|
|
|
@printf "\n=====\n\n"
|
2024-10-06 15:08:25 +00:00
|
|
|
$(MAKE) output
|
|
|
|
|
2024-10-03 01:46:55 +00:00
|
|
|
dns: ./types-dnscontrol.d.ts ./dns/hosts.json ./dns/services.json
|
2024-09-24 23:10:59 +00:00
|
|
|
dnscontrol push
|
|
|
|
|
2024-10-03 01:46:55 +00:00
|
|
|
dns-check: ./types-dnscontrol.d.ts ./dns/hosts.json ./dns/services.json
|
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:
|
|
|
|
tofu output --json \
|
|
|
|
| jq 'with_entries(.value |= .value)' \
|
|
|
|
| ./visualize.py \
|
|
|
|
| d2 - infrastructure.svg
|
|
|
|
|