infrastructure/Makefile

40 lines
921 B
Makefile

SHELL := /bin/bash
include .env
export
PWD := $(shell pwd)
.FORCE:
./dns/hosts.json: .FORCE
tofu output --json \
| jq 'with_entries(.value |= .value).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
./inventory/group_vars/all/opentofu.yaml: .FORCE
tofu output --json \
| yq -y '{opentofu: with_entries(.value |= .value)}' \
> ./inventory/group_vars/all/opentofu.yaml
output: ./dns/hosts.json ./dns/services.json ./inventory/group_vars/all/opentofu.yaml
./types-dnscontrol.d.ts:
dnscontrol write-types
tofu:
tofu apply
echo "\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