Move services.json into ansible

This commit is contained in:
Tobias Reisinger 2024-10-03 03:46:55 +02:00
parent 6548019090
commit 3fed27b42f
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
11 changed files with 188 additions and 153 deletions

View file

@ -3,27 +3,33 @@ SHELL := /bin/bash
include .env
export
DNS_OUTPUT = "dns/hosts.json"
SERVICES_OUTPUT = "inventory/group_vars/all/opentofu.yaml"
PWD := $(shell pwd)
$(DNS_OUTPUT):
.FORCE:
./dns/hosts.json: .FORCE
tofu output --json \
| jq 'with_entries(.value |= .value).hosts' \
> $(DNS_OUTPUT)
> ./dns/hosts.json
$(SERVICES_OUTPUT):
./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)}' \
> $(SERVICES_OUTPUT)
> ./inventory/group_vars/all/opentofu.yaml
outputs: $(DNS_OUTPUT) $(SERVICES_OUTPUT)
outputs: ./dns/hosts.json ./dns/services.json ./inventory/group_vars/all/opentofu.yaml
./types-dnscontrol.d.ts:
dnscontrol write-types
dns: $(DNS_OUTPUT) ./types-dnscontrol.d.ts
dns: ./types-dnscontrol.d.ts ./dns/hosts.json ./dns/services.json
dnscontrol push
dns-check: $(DNS_OUTPUT) ./types-dnscontrol.d.ts
dns-check: ./types-dnscontrol.d.ts ./dns/hosts.json ./dns/services.json
dnscontrol check-creds ovh