2024-10-01 12:17:10 +00:00
|
|
|
- name: Configure DNS records
|
|
|
|
hosts: localhost
|
|
|
|
|
|
|
|
vars_files:
|
|
|
|
- vars/dns-vars.yml
|
2024-10-08 12:41:36 +00:00
|
|
|
- vars/k8s-vars.yml
|
2024-10-01 12:17:10 +00:00
|
|
|
|
|
|
|
tasks:
|
2024-10-21 10:22:32 +00:00
|
|
|
- name: Check if domain exists
|
|
|
|
community.digitalocean.digital_ocean_domain_facts:
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
|
|
|
register: existing_domains
|
|
|
|
|
|
|
|
- name: Fail if domain already exists
|
|
|
|
fail:
|
|
|
|
msg: "Domain {{ full_domain }} already exists."
|
|
|
|
when: full_domain in existing_domains.data | map(attribute='name') | list
|
|
|
|
|
2024-10-01 12:17:10 +00:00
|
|
|
- name: Create a domain
|
|
|
|
community.digitalocean.digital_ocean_domain:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
|
|
|
name: "{{ full_domain }}"
|
|
|
|
ip: "{{ service_provider_ip }}"
|
|
|
|
|
|
|
|
- name: Create record for cluster control machine
|
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: A
|
|
|
|
name: "{{ subdomain_prefix }}-cluster-control"
|
|
|
|
data: "{{ service_provider_ip }}"
|
|
|
|
|
2024-10-08 12:41:36 +00:00
|
|
|
- name: Create record for daemon machine
|
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: A
|
|
|
|
name: "{{ org_id }}-daemon"
|
|
|
|
data: "{{ service_provider_ip }}"
|
|
|
|
|
2024-10-01 12:17:10 +00:00
|
|
|
- name: Create CNAME record for www
|
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
|
|
|
data: "{{ full_domain }}"
|
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: CNAME
|
|
|
|
name: www
|
|
|
|
ttl: 43200
|
|
|
|
|
|
|
|
- name: Create CNAME record for subdomain
|
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
|
|
|
data: "{{ subdomain_cluster_control }}.{{ full_domain }}"
|
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: CNAME
|
2024-10-21 10:22:32 +00:00
|
|
|
name: "{{ subdomain_prefix }}"
|
2024-10-01 12:17:10 +00:00
|
|
|
ttl: 43200
|
|
|
|
|
2024-10-08 12:41:36 +00:00
|
|
|
- name: Create CNAME record for laconicd endpoint
|
2024-10-01 12:17:10 +00:00
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
2024-10-08 12:41:36 +00:00
|
|
|
data: "{{ org_id }}-daemon.{{ full_domain }}"
|
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: CNAME
|
2024-10-21 10:22:32 +00:00
|
|
|
name: "laconicd"
|
2024-10-08 12:41:36 +00:00
|
|
|
ttl: 43200
|
|
|
|
|
|
|
|
- name: Create CNAME record for backend
|
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
|
|
|
data: "{{ org_id }}-daemon.{{ full_domain }}"
|
2024-10-01 12:17:10 +00:00
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: CNAME
|
2024-10-21 10:22:32 +00:00
|
|
|
name: "{{ org_id }}-backend"
|
2024-10-08 12:41:36 +00:00
|
|
|
ttl: 43200
|
|
|
|
|
|
|
|
- name: Create CNAME record for console
|
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
|
|
|
data: "{{ org_id }}-daemon.{{ full_domain }}"
|
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: CNAME
|
2024-10-21 10:22:32 +00:00
|
|
|
name: "{{ org_id }}-console"
|
2024-10-08 12:41:36 +00:00
|
|
|
ttl: 43200
|
|
|
|
|
2024-10-21 10:22:32 +00:00
|
|
|
- name: Create wildcard CNAME record for subdomain
|
2024-10-08 12:41:36 +00:00
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
2024-10-21 10:22:32 +00:00
|
|
|
name: "*.{{ subdomain_prefix }}"
|
|
|
|
data: "{{ subdomain_prefix }}-cluster-control.{{ full_domain }}"
|
2024-10-08 12:41:36 +00:00
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: CNAME
|
2024-10-01 12:17:10 +00:00
|
|
|
ttl: 43200
|
|
|
|
|
|
|
|
- name: Create CNAME record for pwa
|
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
2024-10-21 10:22:32 +00:00
|
|
|
name: "pwa"
|
|
|
|
data: "{{ subdomain_prefix }}-cluster-control.{{ full_domain }}"
|
2024-10-01 12:17:10 +00:00
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: CNAME
|
|
|
|
ttl: 43200
|
|
|
|
|
2024-10-21 10:22:32 +00:00
|
|
|
- name: Create wildcard CNAME record for pwa
|
2024-10-01 12:17:10 +00:00
|
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
|
|
state: present
|
|
|
|
oauth_token: "{{ do_api_token }}"
|
|
|
|
name: "*.pwa"
|
2024-10-21 10:22:32 +00:00
|
|
|
data: "{{ subdomain_prefix }}-cluster-control.{{ full_domain }}"
|
|
|
|
domain: "{{ full_domain }}"
|
|
|
|
type: CNAME
|
2024-10-01 12:17:10 +00:00
|
|
|
ttl: 43200
|