-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure-host-dns.yaml
executable file
·57 lines (54 loc) · 1.78 KB
/
configure-host-dns.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env ansible-playbook
---
- name: Start hcloud_instance
hosts: all
connection: local
gather_facts: no
tasks:
- debug:
msg: "{{ inventory_hostname_short }}-priv.{{ base_domain }}. => {{ hetzner_ip | default(hetzner_ipv6) }} "
- name: Create private DNS record at GCP
gcp_dns_resource_record_set:
name: "{{ inventory_hostname_short }}-private.{{ base_domain }}."
managed_zone:
name: "{{ gcp_managed_zone_name }}"
dnsName: "{{ gcp_managed_zone_domain }}"
type: A
ttl: 300
target:
- "{{ internal_ip }}"
project: "{{ gcp_project }}"
auth_kind: serviceaccount
service_account_file: "{{ gcp_serviceaccount_file }}"
state: present
- name: Create public IPv4 DNS record at GCP
gcp_dns_resource_record_set:
name: "{{ inventory_hostname }}."
managed_zone:
name: "{{ gcp_managed_zone_name }}"
dnsName: "{{ gcp_managed_zone_domain }}"
type: A
ttl: 300
target:
- "{{ hetzner_ip }}"
project: "{{ gcp_project }}"
auth_kind: serviceaccount
service_account_file: "{{ gcp_serviceaccount_file }}"
state: present
when: hetzner_ip is defined
- name: Create public IPv6 DNS record at GCP
become: false
gcp_dns_resource_record_set:
name: "{{ inventory_hostname }}."
managed_zone:
name: "{{ gcp_managed_zone_name }}"
dnsName: "{{ gcp_managed_zone_domain }}"
type: AAAA
ttl: 300
target:
- "{{ hetzner_ipv6 }}"
project: "{{ gcp_project }}"
auth_kind: serviceaccount
service_account_file: "{{ gcp_serviceaccount_file }}"
state: present
when: hetzner_ipv6 is defined