Debian Codegraph @

ansible_collections/microsoft/ad/tests/integration/targets/ou/tasks/tests.yml

raw symbols SCIP
1 - name: create ou - check
2 ou:
3 name: MyOU
4 state: present
5 register: create_ou_check
6 check_mode: true
7
8 - name: get result of create ou - check
9 object_info:
10 identity: '{{ create_ou_check.distinguished_name }}'
11 register: create_ou_check_actual
12
13 - name: assert create ou - check
14 assert:
15 that:
16 - create_ou_check is changed
17 - create_ou_check.distinguished_name == 'OU=MyOU,' ~ setup_domain_info.output[0].defaultNamingContext
18 - create_ou_check.object_guid == '00000000-0000-0000-0000-000000000000'
19 - create_ou_check_actual.objects == []
20
21 - name: create ou
22 ou:
23 name: MyOU
24 state: present
25 register: create_ou
26
27 - set_fact:
28 object_identity: '{{ create_ou.object_guid }}'
29
30 - name: get result of create ou
31 object_info:
32 identity: '{{ object_identity }}'
33 properties:
34 - ProtectedFromAccidentalDeletion
35 register: create_ou_actual
36
37 - name: assert create ou
38 assert:
39 that:
40 - create_ou is changed
41 - create_ou_actual.objects | length == 1
42 - create_ou.distinguished_name == 'OU=MyOU,' ~ setup_domain_info.output[0].defaultNamingContext
43 - create_ou.distinguished_name == create_ou_actual.objects[0].DistinguishedName
44 - create_ou.object_guid == create_ou_actual.objects[0].ObjectGUID
45 - create_ou_actual.objects[0].Name == 'MyOU'
46 - create_ou_actual.objects[0].ObjectClass == 'organizationalUnit'
47 - create_ou_actual.objects[0].ProtectedFromAccidentalDeletion == true
48
49 - name: remove ou - check
50 ou:
51 name: MyOU
52 state: absent
53 register: remove_ou_check
54 check_mode: true
55
56 - name: get result of remove ou - check
57 object_info:
58 identity: '{{ object_identity }}'
59 register: remove_ou_check_actual
60
61 - name: assert remove ou - check
62 assert:
63 that:
64 - remove_ou_check is changed
65 - remove_ou_check_actual.objects | length == 1
66
67 - name: remove ou
68 ou:
69 name: MyOU
70 state: absent
71 register: remove_ou
72
73 - name: get result of remove ou
74 object_info:
75 identity: '{{ object_identity }}'
76 register: remove_ou_actual
77
78 - name: assert remove ou
79 assert:
80 that:
81 - remove_ou is changed
82 - remove_ou_actual.objects == []
83
84 - name: remove ou - idempotent
85 ou:
86 name: MyOU
87 state: absent
88 register: remove_ou_again
89
90 - name: assert remove ou - idempotent
91 assert:
92 that:
93 - not remove_ou_again is changed
94
95 - name: create parent OU
96 ou:
97 name: MyOU
98 state: present
99 register: parent_ou
100
101 - set_fact:
102 object_identity: '{{ parent_ou.object_guid }}'
103
104 - name: create ou with custom options
105 ou:
106 name: SubOU
107 path: '{{ parent_ou.distinguished_name }}'
108 state: present
109 city: Brisbane
110 country: AU
111 description: Custom Description
112 display_name: OU Display Name
113 managed_by: Domain Admins
114 postal_code: 4000
115 state_province: QLD
116 street: Main St
117 protect_from_deletion: false
118 attributes:
119 set:
120 postOfficeBox: My Box
121 register: create_ou_custom
122
123 - name: get result of create ou with custom options
124 object_info:
125 identity: '{{ create_ou_custom.object_guid }}'
126 properties:
127 - c
128 - Description
129 - DisplayName
130 - l
131 - managedBy
132 - postalcode
133 - postOfficeBox
134 - st
135 - street
136 - ProtectedFromAccidentalDeletion
137 register: create_ou_custom_actual
138
139 - name: assert create ou with custom options
140 assert:
141 that:
142 - create_ou_custom is changed
143 - create_ou_custom_actual.objects | length == 1
144 - create_ou_custom.distinguished_name == create_ou_custom_actual.objects[0].DistinguishedName
145 - create_ou_custom.object_guid == create_ou_custom_actual.objects[0].ObjectGUID
146 - create_ou_custom_actual.objects[0].l == 'Brisbane'
147 - create_ou_custom_actual.objects[0].c == 'AU'
148 - create_ou_custom_actual.objects[0].Description == 'Custom Description'
149 - create_ou_custom_actual.objects[0].DisplayName == 'OU Display Name'
150 - create_ou_custom_actual.objects[0].managedBy == 'CN=Domain Admins,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext
151 - create_ou_custom_actual.objects[0].postalcode == '4000'
152 - create_ou_custom_actual.objects[0].st == 'QLD'
153 - create_ou_custom_actual.objects[0].street == 'Main St'
154 - create_ou_custom_actual.objects[0].ProtectedFromAccidentalDeletion == False
155 - create_ou_custom_actual.objects[0].postOfficeBox == ['My Box']
156
157 - name: change ou with custom options
158 ou:
159 name: SubOU
160 path: '{{ parent_ou.distinguished_name }}'
161 state: present
162 city: New York
163 country: US
164 description: Custom description
165 display_name: OU display Name
166 managed_by:
167 name: Domain Users
168 postal_code: 10001
169 state_province: ''
170 street: Main
171 attributes:
172 set:
173 postOfficeBox: My box
174 register: change_ou
175
176 - name: get result of change ou with custom options
177 object_info:
178 identity: '{{ create_ou_custom.object_guid }}'
179 properties:
180 - c
181 - Description
182 - DisplayName
183 - l
184 - managedBy
185 - postalcode
186 - postOfficeBox
187 - st
188 - street
189 - ProtectedFromAccidentalDeletion
190 register: change_ou_actual
191
192 - name: assert change ou with custom options
193 assert:
194 that:
195 - change_ou is changed
196 - change_ou.distinguished_name == create_ou_custom.distinguished_name
197 - change_ou.object_guid == create_ou_custom.object_guid
198 - change_ou_actual.objects[0].l == 'New York'
199 - change_ou_actual.objects[0].c == 'US'
200 - change_ou_actual.objects[0].Description == 'Custom description'
201 - change_ou_actual.objects[0].DisplayName == 'OU display Name'
202 - change_ou_actual.objects[0].managedBy == 'CN=Domain Users,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext
203 - change_ou_actual.objects[0].postalcode == '10001'
204 - change_ou_actual.objects[0].st == None
205 - change_ou_actual.objects[0].street == 'Main'
206 - change_ou_actual.objects[0].ProtectedFromAccidentalDeletion == False
207 - change_ou_actual.objects[0].postOfficeBox == ['My box']
208
209 - name: create new sub OU
210 ou:
211 name: NewSubOU
212 path: '{{ parent_ou.distinguished_name }}'
213 state: present
214 register: new_parent_ou
215
216 - name: move and rename ou - check
217 ou:
218 name: InnerOU
219 path: '{{ new_parent_ou.distinguished_name }}'
220 identity: '{{ create_ou_custom.object_guid }}'
221 register: move_rename_check
222 check_mode: true
223
224 - name: get result of move and rename ou - check
225 object_info:
226 identity: '{{ create_ou_custom.object_guid }}'
227 register: move_rename_check_actual
228
229 - name: assert move and rename ou - check
230 assert:
231 that:
232 - move_rename_check is changed
233 - move_rename_check.distinguished_name == 'OU=InnerOU,' ~ new_parent_ou.distinguished_name
234 - move_rename_check_actual.objects[0].Name == 'SubOU'
235 - move_rename_check_actual.objects[0].DistinguishedName == create_ou_custom_actual.objects[0].DistinguishedName
236
237 - name: move and rename ou
238 ou:
239 name: InnerOU
240 path: '{{ new_parent_ou.distinguished_name }}'
241 identity: '{{ create_ou_custom.object_guid }}'
242 register: move_rename
243
244 - name: get result of move and rename ou
245 object_info:
246 identity: '{{ create_ou_custom.object_guid }}'
247 register: move_rename_actual
248
249 - name: assert move and rename ou
250 assert:
251 that:
252 - move_rename is changed
253 - move_rename.distinguished_name == 'OU=InnerOU,' ~ new_parent_ou.distinguished_name
254 - move_rename_actual.objects[0].Name == 'InnerOU'
255 - move_rename_actual.objects[0].DistinguishedName == 'OU=InnerOU,' ~ new_parent_ou.distinguished_name