Debian Codegraph @

ansible_collections/community/vmware/tests/integration/targets/vmware_host_dns/tasks/static.yml

raw
1 - name: Tests when the hosts have a static DNS config
2 block:
3 # Testcase 0001: Ensure DNS config directly on the host is idempotent for static
4 - name: Ensure static DNS config is idempotent when done directly on the host
5 vmware_host_dns:
6 hostname: '{{ esxi1 }}'
7 username: '{{ esxi_user }}'
8 password: '{{ esxi_password }}'
9 validate_certs: false
10 type: 'static'
11 host_name: "{{ dns['results'][0]['hosts_dns_info'][esxi1]['host_name'] }}"
12 register: vmware_host_dns_result_0001
13 - name: Ensure DNS config wasn't changed
14 assert:
15 that:
16 - vmware_host_dns_result_0001 is not changed
17
18 - name: Revert to original DNS configuration
19 include_tasks: teardown.yaml
20
21 # Testcase 0002: Ensure changing the hostname directly on the host works
22 - name: Ensure changing the hostname directly on the host works
23 vmware_host_dns:
24 hostname: '{{ esxi1 }}'
25 username: '{{ esxi_user }}'
26 password: '{{ esxi_password }}'
27 validate_certs: false
28 type: 'static'
29 host_name: newname
30 register: vmware_host_dns_result_0002
31
32 - name: Ensure DNS config was changed
33 assert:
34 that:
35 - vmware_host_dns_result_0002 is changed
36
37 - name: Revert to original DNS configuration
38 include_tasks: teardown.yaml
39
40 # Testcase 0003: Ensure changing the domain directly on the host works
41 - name: Ensure changing the domain directly on the host works
42 vmware_host_dns:
43 hostname: '{{ esxi1 }}'
44 username: '{{ esxi_user }}'
45 password: '{{ esxi_password }}'
46 validate_certs: false
47 type: 'static'
48 domain: new.domain
49 register: vmware_host_dns_result_0003
50
51 - name: Ensure DNS config was changed
52 assert:
53 that:
54 - vmware_host_dns_result_0003 is changed
55
56 - name: Revert to original DNS configuration
57 include_tasks: teardown.yaml
58
59 # Testcase 0004: Ensure changing the DNS servers directly on the host works
60 - name: Ensure changing the domain directly on the host works
61 vmware_host_dns:
62 hostname: '{{ esxi1 }}'
63 username: '{{ esxi_user }}'
64 password: '{{ esxi_password }}'
65 validate_certs: false
66 type: 'static'
67 dns_servers:
68 - 1.2.3.4
69 - 5.6.7.8
70 register: vmware_host_dns_result_0004
71
72 - name: Ensure DNS config was changed
73 assert:
74 that:
75 - vmware_host_dns_result_0004 is changed
76
77 - name: Revert to original DNS configuration
78 include_tasks: teardown.yaml
79
80 # Testcase 0005: Ensure changing the search domain directly on the host works
81 - name: Ensure changing the domain directly on the host works
82 vmware_host_dns:
83 hostname: '{{ esxi1 }}'
84 username: '{{ esxi_user }}'
85 password: '{{ esxi_password }}'
86 validate_certs: false
87 type: 'static'
88 search_domains:
89 - subdomain.example.local
90 - example.local
91 register: vmware_host_dns_result_0005
92
93 - name: Ensure DNS config was changed
94 assert:
95 that:
96 - vmware_host_dns_result_0005 is changed
97
98 - name: Revert to original DNS configuration
99 include_tasks: teardown.yaml
100
101 # Testcase 0006: Ensure DNS config on the cluster is idempotent for static
102 - name: Apply configuration on a cluster
103 vmware_host_dns:
104 hostname: '{{ vcenter_hostname }}'
105 username: '{{ vcenter_username }}'
106 password: '{{ vcenter_password }}'
107 cluster_name: "{{ ccr1 }}"
108 validate_certs: false
109 type: 'static'
110 search_domains: "different-search-domain"
111 register: vmware_host_dns_result_0006
112
113 - name: Ensure configuration has changed
114 assert:
115 that:
116 - vmware_host_dns_result_0006 is changed
117
118 - name: Revert to original DNS configuration
119 include_tasks: teardown.yaml
120
121 # Testcase 0007: Ensure changing the domain on the cluster works
122 - name: Ensure changing the domain on the cluster works
123 vmware_host_dns:
124 hostname: '{{ vcenter_hostname }}'
125 username: '{{ vcenter_username }}'
126 password: '{{ vcenter_password }}'
127 cluster_name: "{{ ccr1 }}"
128 validate_certs: false
129 type: 'static'
130 domain: new.domain
131 register: vmware_host_dns_result_0007
132
133 - name: Ensure DNS config was changed
134 assert:
135 that:
136 - vmware_host_dns_result_0007 is changed
137
138 - name: Revert to original DNS configuration
139 include_tasks: teardown.yaml
140
141 # Testcase 0008: Ensure changing the DNS servers on the cluster works
142 - name: Ensure changing the DNS servers on the cluster works
143 vmware_host_dns:
144 hostname: '{{ vcenter_hostname }}'
145 username: '{{ vcenter_username }}'
146 password: '{{ vcenter_password }}'
147 cluster_name: "{{ ccr1 }}"
148 validate_certs: false
149 type: 'static'
150 dns_servers:
151 - 1.2.3.4
152 - 5.6.7.8
153 register: vmware_host_dns_result_0008
154
155 - name: Ensure DNS config was changed
156 assert:
157 that:
158 - vmware_host_dns_result_0008 is changed
159
160 - name: Revert to original DNS configuration
161 include_tasks: teardown.yaml
162
163 # Testcase 0009: Ensure changing the search domains on the cluster works
164 - name: Ensure changing the search domains on the cluster works
165 vmware_host_dns:
166 hostname: '{{ vcenter_hostname }}'
167 username: '{{ vcenter_username }}'
168 password: '{{ vcenter_password }}'
169 cluster_name: "{{ ccr1 }}"
170 validate_certs: false
171 type: 'static'
172 search_domains:
173 - subdomain.example.local
174 - example.local
175 register: vmware_host_dns_result_0009
176
177 - name: Ensure DNS config was changed
178 assert:
179 that:
180 - vmware_host_dns_result_0009 is changed
181
182 - name: Revert to original DNS configuration
183 include_tasks: teardown.yaml
184
185 - name: Remove all the DNS servers
186 vmware_host_dns:
187 hostname: '{{ vcenter_hostname }}'
188 username: '{{ vcenter_username }}'
189 password: '{{ vcenter_password }}'
190 cluster_name: "{{ ccr1 }}"
191 validate_certs: false
192 type: 'static'
193 dns_servers: []
194 register: vmware_host_dns_result_0010
195
196 - name: Ensure DNS config was changed
197 assert:
198 that:
199 - vmware_host_dns_result_0010 is changed
200
201 - name: Remove the domain
202 vmware_host_dns:
203 hostname: '{{ vcenter_hostname }}'
204 username: '{{ vcenter_username }}'
205 password: '{{ vcenter_password }}'
206 cluster_name: "{{ ccr1 }}"
207 validate_certs: false
208 type: 'static'
209 domain: ''
210 register: vmware_host_dns_result_0011
211
212 - name: Ensure the server has no domain
213 assert:
214 that:
215 - vmware_host_dns_result_0011 is changed
216
217
218 - name: Revert to original DNS configuration
219 include_tasks: teardown.yaml
220
221 always:
222 - name: Revert to original DNS configuration
223 include_tasks: teardown.yaml