56 lines
1.2 KiB
YAML
56 lines
1.2 KiB
YAML
|
####################
|
||
|
# - Check Variables
|
||
|
####################
|
||
|
- name: "[Play] Check Variables"
|
||
|
assert:
|
||
|
that:
|
||
|
- "nodes_to_ipv4s_public is defined"
|
||
|
- "ipv4_root is defined"
|
||
|
|
||
|
####################
|
||
|
# - Set DNS A Records => Hosts
|
||
|
####################
|
||
|
- name: "Set Node DNS A => *.node.{{ dns_root }}"
|
||
|
cloudflare_dns:
|
||
|
api_token: "{{ cloudflare_dns_token }}"
|
||
|
|
||
|
zone: "{{ dns_root }}"
|
||
|
type: "A"
|
||
|
solo: true
|
||
|
|
||
|
record: "{{ item.key }}"
|
||
|
value: "{{ item.value }}"
|
||
|
with_dict: "{{ nodes_to_ipv4s_public }}"
|
||
|
|
||
|
####################
|
||
|
# - Set DNS A Record => @
|
||
|
####################
|
||
|
- name: "Set DNS A => Primary Node"
|
||
|
cloudflare_dns:
|
||
|
api_token: "{{ cloudflare_dns_token }}"
|
||
|
|
||
|
zone: "{{ dns_root }}"
|
||
|
type: "A"
|
||
|
solo: true
|
||
|
|
||
|
record: "@"
|
||
|
value: "{{ ipv4_root }}"
|
||
|
|
||
|
- name: "Wait for Node DNS Propagation"
|
||
|
debug:
|
||
|
msg: "Waiting..."
|
||
|
until: "lookup(
|
||
|
'community.general.dig',
|
||
|
item.key ~ '.' ~ dns_root
|
||
|
) == item.value"
|
||
|
retries: 30
|
||
|
delay: 10
|
||
|
with_dict: "{{ nodes_to_ipv4s_public }}"
|
||
|
|
||
|
- name: "Wait for Primary DNS Propagation"
|
||
|
debug:
|
||
|
msg: "Waiting..."
|
||
|
until: "lookup('community.general.dig', dns_root) == ipv4_root"
|
||
|
retries: 30
|
||
|
delay: 10
|