Prathamesh Musale
2e0fbd82f1
Part of [Service Provider setup](https://www.notion.so/Service-provider-setup-a09e2207e1f34f3a847f7ce9713b7ac5) and [Service provider auctions for web deployments](https://www.notion.so/Service-provider-auctions-for-web-deployments-104a6b22d47280dbad51d28aa3a91d75) - Configure laconicd chain id - Configure whether deployer should handle auctions and amount to bid - Update playbook to issue wildcard cert on deploying k8s Co-authored-by: Adw8 <adwaitgharpure@gmail.com> Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> Reviewed-on: #12 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
123 lines
3.9 KiB
YAML
123 lines
3.9 KiB
YAML
- name: Configure DNS records
|
|
hosts: localhost
|
|
|
|
vars_files:
|
|
- vars/dns-vars.yml
|
|
- vars/k8s-vars.yml
|
|
|
|
tasks:
|
|
- 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
|
|
|
|
- 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 }}"
|
|
|
|
- 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 }}"
|
|
|
|
- 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
|
|
name: "{{ subdomain_prefix }}"
|
|
ttl: 43200
|
|
|
|
- name: Create CNAME record for laconicd endpoint
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
state: present
|
|
oauth_token: "{{ do_api_token }}"
|
|
data: "{{ org_id }}-daemon.{{ full_domain }}"
|
|
domain: "{{ full_domain }}"
|
|
type: CNAME
|
|
name: "laconicd"
|
|
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 }}"
|
|
domain: "{{ full_domain }}"
|
|
type: CNAME
|
|
name: "{{ org_id }}-backend"
|
|
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
|
|
name: "{{ org_id }}-console"
|
|
ttl: 43200
|
|
|
|
- name: Create wildcard CNAME record for subdomain
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
state: present
|
|
oauth_token: "{{ do_api_token }}"
|
|
name: "*.{{ subdomain_prefix }}"
|
|
data: "{{ subdomain_prefix }}-cluster-control.{{ full_domain }}"
|
|
domain: "{{ full_domain }}"
|
|
type: CNAME
|
|
ttl: 43200
|
|
|
|
- name: Create CNAME record for pwa
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
state: present
|
|
oauth_token: "{{ do_api_token }}"
|
|
name: "pwa"
|
|
data: "{{ subdomain_prefix }}-cluster-control.{{ full_domain }}"
|
|
domain: "{{ full_domain }}"
|
|
type: CNAME
|
|
ttl: 43200
|
|
|
|
- name: Create wildcard CNAME record for pwa
|
|
community.digitalocean.digital_ocean_domain_record:
|
|
state: present
|
|
oauth_token: "{{ do_api_token }}"
|
|
name: "*.pwa"
|
|
data: "{{ subdomain_prefix }}-cluster-control.{{ full_domain }}"
|
|
domain: "{{ full_domain }}"
|
|
type: CNAME
|
|
ttl: 43200
|