-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure_rm_recordset.yml
executable file
·174 lines (156 loc) · 4.74 KB
/
azure_rm_recordset.yml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
- name: Create random domain name
set_fact:
domain_name: "{{ resource_group | hash('md5') | truncate(16, True, '') + (65535 | random | string) }}"
- name: Create a DNS zone
azure_rm_dnszone:
resource_group: "{{ resource_group }}"
name: "{{ domain_name }}.com"
state: present
register: results
- name: create "A" record set with multiple records
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: www
zone_name: "{{ domain_name }}.com"
record_type: A
a_records:
- ipv4_address: 192.168.100.101
- ipv4_address: 192.168.100.102
- ipv4_address: 192.168.100.103
register: results
- name: create SRV records in a new record set
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: "_sip._tcp.{{ domain_name }}.com"
zone_name: "{{ domain_name }}.com"
ttl: 7200
record_type: SRV
srv_records:
- target: sip.{{ domain_name }}.com
priority: 20
weight: 10
port: 5060
register: results
- name: create TXT records in a new record set
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: "_txt.{{ domain_name }}.com"
ttl: 7200
zone_name: "{{ domain_name }}.com"
record_type: TXT
txt_records:
- value:
- "foo"
- "bz2"
register: results
- name: create AAAA records in a new record set
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: "_txt.{{ domain_name }}.com"
zone_name: "{{ domain_name }}.com"
record_type: AAAA
ttl: 7200
aaaa_records:
- ipv6_address: 0000:0000:0000:0000:0000:ffff:c0a8:5909
register: output
- name: create MX records in a new record set
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: "_txt.{{ domain_name }}.com"
zone_name: "{{ domain_name }}.com"
record_type: MX
ttl: 7200
mx_records:
- preference: 1
exchange: mail.contoso.com
register: output
- name: create NS records in a new record set
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: "_txt.{{ domain_name }}.com"
zone_name: "{{ domain_name }}.com"
record_type: NS
ttl: 7200
ns_records:
- nsdname: ns.contoso.com
register: output
- name: create PTR records in a new record set
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: "_txt.{{ domain_name }}.com"
zone_name: "{{ domain_name }}.com"
ttl: 7200
record_type: PTR
ptr_records:
- ptrdname: test7.testdomain.com
register: output
- name: create CNAME records in a new record set
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: record1
zone_name: "{{ domain_name }}.com"
record_type: CNAME
ttl: 7200
cname_record:
cname: "www.fabrikam.net"
register: output
- name: create SOA records in a new record set
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: "@"
zone_name: "{{ domain_name }}.com"
record_type: SOA
ttl: 7200
soa_record:
host: ns1-06.azure-dns.com
email: azuredns-hostmaster.microsoft.com
serial_number: 1
refresh_time: 3600
retry_time: 300
expire_time: 2419200
minimum_ttl: 300
register: output
- name: create CAA records in a new record set
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: "_txt.{{ domain_name }}.com"
zone_name: "{{ domain_name }}.com"
record_type: CAA
ttl: 7200
caa_records:
- flags: 1
tag: tags1
value: value1
register: output
- name: get the RecordSet
azure_rm_recordset_info:
resource_group: "{{ resource_group }}"
relative_record_set_name: "_txt.{{ domain_name }}.com"
zone_name: "{{ domain_name }}.com"
record_type: CAA
register: output
- name: Lists the record sets of a specified type in a DNS zone
azure_rm_recordset_info:
resource_group: "{{ resource_group }}"
zone_name: "{{ domain_name }}.com"
record_type: CAA
register: output
- name: Lists all record sets in a DNS zone
azure_rm_recordset_info:
resource_group: "{{ resource_group }}"
zone_name: "{{ domain_name }}.com"
register: output
- name: delete the RecordSet
azure_rm_recordset:
resource_group: "{{ resource_group }}"
relative_record_set_name: "_txt.{{ domain_name }}.com"
record_type: CAA
zone_name: "{{ domain_name }}.com"
state: absent
register: output
#- name: Delete a DNS zone
# azure_rm_dnszone:
# resource_group: "{{ resource_group }}"
# name: "{{ domain_name }}.com"
# state: absent
# register: results