Debian Codegraph @

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

raw symbols SCIP
1 - name: expect failure if dns_hostname is not set for state=present
2 service_account:
3 name: MySA
4 state: present
5 register: fail_no_dns
6 failed_when: >-
7 fail_no_dns.msg != 'dns_hostname is required when creating a new service account.'
8
9 - name: expect failure if dns_hostname and outbound_auth_only is set
10 service_account:
11 name: MySA
12 dns_hostname: DNSName
13 outbound_auth_only: true
14 register: fail_dns_outbound
15 failed_when: >-
16 fail_dns_outbound.msg != 'dns_hostname can not be set when outbound_auth_only=true.'
17
18 - name: create sa - check
19 service_account:
20 name: MySA
21 dns_hostname: DNSName
22 state: present
23 register: create_sa_check
24 check_mode: true
25
26 - name: get result of create sa - check
27 object_info:
28 identity: '{{ create_sa_check.distinguished_name }}'
29 register: create_sa_check_actual
30
31 - name: assert create sa - check
32 assert:
33 that:
34 - create_sa_check is changed
35 - create_sa_check.distinguished_name == 'CN=MySA,CN=Managed Service Accounts,' ~ setup_domain_info.output[0].defaultNamingContext
36 - create_sa_check.object_guid == '00000000-0000-0000-0000-000000000000'
37 - create_sa_check.sid == 'S-1-5-0000'
38 - create_sa_check_actual.objects == []
39
40 - name: create sa
41 service_account:
42 name: MySA
43 dns_hostname: DNSName
44 state: present
45 register: create_sa
46
47 - set_fact:
48 object_identity: '{{ create_sa.object_guid }}'
49
50 - name: get result of create sa
51 object_info:
52 identity: '{{ object_identity }}'
53 properties:
54 - dnsHostName
55 - objectSid
56 - sAMAccountName
57 - userAccountControl
58 register: create_sa_actual
59
60 - name: assert create sa
61 assert:
62 that:
63 - create_sa is changed
64 - create_sa_actual.objects | length == 1
65 - create_sa.distinguished_name == 'CN=MySA,CN=Managed Service Accounts,' ~ setup_domain_info.output[0].defaultNamingContext
66 - create_sa.object_guid == create_sa_actual.objects[0].ObjectGUID
67 - create_sa.sid == create_sa_actual.objects[0].objectSid.Sid
68 - create_sa_actual.objects[0].DistinguishedName == create_sa.distinguished_name
69 - create_sa_actual.objects[0].Name == 'MySA'
70 - create_sa_actual.objects[0].dnsHostName == 'DNSName'
71 - create_sa_actual.objects[0].sAMAccountName == 'MySA$'
72 - create_sa_actual.objects[0].ObjectClass == 'msDS-GroupManagedServiceAccount'
73 - '"ADS_UF_ACCOUNTDISABLE" not in create_sa_actual.objects[0].userAccountControl_AnsibleFlags'
74
75 - name: create sa - idempotent
76 service_account:
77 name: MySA
78 dns_hostname: DNSName
79 state: present
80 register: create_sa_again
81
82 - name: assert create sa - idempotent
83 assert:
84 that:
85 - not create_sa_again is changed
86
87 - name: remove sa - check
88 service_account:
89 identity: MySA
90 state: absent
91 register: remove_sa_check
92 check_mode: true
93
94 - name: get result of remove sa - check
95 object_info:
96 identity: '{{ object_identity }}'
97 register: remove_sa_check_actual
98
99 - name: assert remove sa - check
100 assert:
101 that:
102 - remove_sa_check is changed
103 - remove_sa_check.distinguished_name == create_sa.distinguished_name
104 - remove_sa_check.object_guid == create_sa.object_guid
105 - remove_sa_check.sid == create_sa.sid
106 - remove_sa_check_actual.objects | length == 1
107
108 - name: remove sa
109 service_account:
110 identity: MySA
111 state: absent
112 register: remove_sa
113
114 - name: get result of remove sa
115 object_info:
116 identity: '{{ object_identity }}'
117 register: remove_sa_actual
118
119 - name: assert remove sa - check
120 assert:
121 that:
122 - remove_sa is changed
123 - remove_sa.distinguished_name == create_sa.distinguished_name
124 - remove_sa.object_guid == create_sa.object_guid
125 - remove_sa.sid == create_sa.sid
126 - remove_sa_actual.objects == []
127
128 - name: remove sa - idempotent
129 service_account:
130 identity: MySA
131 state: absent
132 register: remove_sa_again
133
134 - name: assert remove sa - idempotent
135 assert:
136 that:
137 - not remove_sa_again is changed
138
139 - name: create test OU container
140 ou:
141 name: TestOU
142 state: present
143 register: test_ou
144
145 - block:
146 - name: create sa with outbound auth only - check
147 service_account:
148 identity: MySA
149 path: '{{ test_ou.distinguished_name }}'
150 sam_account_name: OtherSA
151 allowed_to_retrieve_password:
152 set:
153 - Domain Admins
154 outbound_auth_only: true
155 register: create_sa_outbound_check
156 check_mode: true
157
158 - name: get result of create sa with outbound auth only - check
159 object_info:
160 identity: '{{ create_sa_outbound_check.distinguished_name }}'
161 register: create_sa_outbound_actual_check
162
163 - name: assert create sa with outbound auth only - check
164 assert:
165 that:
166 - create_sa_outbound_check is changed
167 - create_sa_outbound_check.distinguished_name == 'CN=MySA,' ~ test_ou.distinguished_name
168 - create_sa_outbound_actual_check.objects == []
169
170 - name: create sa with outbound auth only
171 service_account:
172 name: MySA
173 path: '{{ test_ou.distinguished_name }}'
174 sam_account_name: OtherSA
175 allowed_to_retrieve_password:
176 set:
177 - Domain Admins
178 outbound_auth_only: true
179 register: create_sa_outbound
180
181 - set_fact:
182 object_identity: '{{ create_sa_outbound.object_guid }}'
183
184 - name: get result of create sa with outbound auth only
185 ansible.windows.win_powershell:
186 parameters:
187 Identity: '{{ object_identity }}'
188 Properties:
189 - DistinguishedName
190 - Name
191 - ObjectGUID
192 - SID
193 - SamAccountName
194 - PrincipalsAllowedToRetrieveManagedPassword
195 script: |
196 param ($Identity, $Properties)
197
198 Get-ADServiceAccount -Identity $Identity -Properties $Properties |
199 Select-Object -Property $Properties
200 register: create_sa_outbound_actual
201
202 - name: assert create sa with outbound auth only
203 assert:
204 that:
205 - create_sa_outbound is changed
206 - create_sa_outbound.distinguished_name == 'CN=MySA,' ~ test_ou.distinguished_name
207 - create_sa_outbound_actual.output | length == 1
208 - create_sa_outbound_actual.output[0].DistinguishedName == create_sa_outbound.distinguished_name
209 - create_sa_outbound_actual.output[0].Name == 'MySA'
210 - create_sa_outbound_actual.output[0].ObjectGUID == create_sa_outbound.object_guid
211 - create_sa_outbound_actual.output[0].PrincipalsAllowedToRetrieveManagedPassword == ['CN=Domain Admins,CN=Users,' ~ setup_domain_info.output[0].defaultNamingContext]
212 - create_sa_outbound_actual.output[0].SID.Value == create_sa_outbound.sid
213 - create_sa_outbound_actual.output[0].SamAccountName == 'OtherSA$'
214
215 - name: create sa with outbound auth only - idempotent
216 service_account:
217 identity: OtherSA
218 path: '{{ test_ou.distinguished_name }}'
219 sam_account_name: OtherSA
220 allowed_to_retrieve_password:
221 set:
222 - name: Domain Admins
223 outbound_auth_only: true
224 register: create_sa_outbound_again
225
226 - name: assert create sa with outbound auth only - idempotent
227 assert:
228 that:
229 - not create_sa_outbound_again is changed
230
231 - name: remove sa with outbound auth only
232 service_account:
233 identity: OtherSA$
234 state: absent
235 register: remove_sa_outbound
236
237 - name: get result of remove sa with outbound auth only
238 object_info:
239 identity: '{{ object_identity }}'
240 register: remove_sa_outbound_actual
241
242 - name: assert remove sa with outbound auth only
243 assert:
244 that:
245 - remove_sa_outbound is changed
246 - remove_sa_outbound.distinguished_name == create_sa_outbound.distinguished_name
247 - remove_sa_outbound.object_guid == create_sa_outbound.object_guid
248 - remove_sa_outbound.sid == create_sa_outbound.sid
249 - remove_sa_outbound_actual.objects == []
250
251 always:
252 - name: remove test OU container
253 ou:
254 identity: '{{ test_ou.object_guid }}'
255 state: absent
256
257 - name: create sa with no $ suffix - check
258 service_account:
259 name: MySA
260 dns_hostname: DNSName
261 state: present
262 sam_account_name: SATest
263 do_not_append_dollar_to_sam: true
264 kerberos_encryption_types:
265 add:
266 - aes128
267 - aes256
268 register: create_sa_no_dollar_check
269 check_mode: true
270
271 - name: get result of create sa with no $ suffix - check
272 object_info:
273 identity: '{{ create_sa_no_dollar_check.distinguished_name }}'
274 register: create_sa_no_dollar_check_actual
275
276 - name: create sa with no $ suffix - check
277 assert:
278 that:
279 - create_sa_no_dollar_check is changed
280 - create_sa_no_dollar_check_actual.objects == []
281
282 - name: create sa with no $ suffix
283 service_account:
284 name: MySA
285 dns_hostname: DNSName
286 state: present
287 sam_account_name: SATest
288 do_not_append_dollar_to_sam: true
289 kerberos_encryption_types:
290 add:
291 - aes128
292 - aes256
293 register: create_sa_no_dollar
294
295 - set_fact:
296 object_identity: '{{ create_sa_no_dollar.object_guid }}'
297
298 - name: get result of create sa with no $ suffix
299 object_info:
300 identity: '{{ create_sa_no_dollar_check.distinguished_name }}'
301 properties:
302 - msDS-SupportedEncryptionTypes
303 - sAMAccountName
304 register: create_sa_no_dollar_actual
305
306 - name: create sa with no $ suffix
307 assert:
308 that:
309 - create_sa_no_dollar is changed
310 - create_sa_no_dollar_actual.objects | length == 1
311 - create_sa_no_dollar_actual.objects[0].DistinguishedName == create_sa_no_dollar.distinguished_name
312 - create_sa_no_dollar_actual.objects[0]['msDS-SupportedEncryptionTypes'] == 24
313 - create_sa_no_dollar_actual.objects[0].Name == 'MySA'
314 - create_sa_no_dollar_actual.objects[0].ObjectGUID == create_sa_no_dollar.object_guid
315 - create_sa_no_dollar_actual.objects[0].sAMAccountName == 'SATest'
316
317 - name: create sa with no $ suffix - idempotent
318 service_account:
319 name: MySA
320 dns_hostname: DNSName
321 state: present
322 sam_account_name: SATest
323 do_not_append_dollar_to_sam: true
324 kerberos_encryption_types:
325 add:
326 - aes128
327 - aes256
328 register: create_sa_no_dollar_again
329
330 - name: assert create sa with no $ suffix - idempotent
331 assert:
332 that:
333 - not create_sa_no_dollar_again is changed
334
335 - name: convert sa to outbound auth and change sAMAccountName - check
336 service_account:
337 name: MySA
338 state: present
339 kerberos_encryption_types:
340 remove:
341 - aes128
342 - des
343 sam_account_name: NewSATest
344 outbound_auth_only: true
345 register: convert_sa_outbound_check
346 check_mode: true
347
348 - name: get result of convert sa to outbound auth and change sAMAccountName - check
349 object_info:
350 identity: '{{ create_sa_no_dollar_check.distinguished_name }}'
351 properties:
352 - dnsHostName
353 - msDS-SupportedEncryptionTypes
354 - sAMAccountName
355 register: convert_sa_outbound_check_actual
356
357 - name: assert get result of convert sa to outbound auth and change sAMAccountName - check
358 assert:
359 that:
360 - convert_sa_outbound_check is changed
361 - convert_sa_outbound_check_actual.objects | length == 1
362 - convert_sa_outbound_check_actual.objects[0].DistinguishedName == create_sa_no_dollar.distinguished_name
363 - convert_sa_outbound_check_actual.objects[0].dnsHostName == 'DNSName'
364 - convert_sa_outbound_check_actual.objects[0]['msDS-SupportedEncryptionTypes'] == 24
365 - convert_sa_outbound_check_actual.objects[0].Name == 'MySA'
366 - convert_sa_outbound_check_actual.objects[0].ObjectGUID == create_sa_no_dollar.object_guid
367 - convert_sa_outbound_check_actual.objects[0].sAMAccountName == 'SATest'
368
369 - name: convert sa to outbound auth and change sAMAccountName
370 service_account:
371 name: MySA
372 state: present
373 kerberos_encryption_types:
374 remove:
375 - aes128
376 - des
377 sam_account_name: NewSATest
378 outbound_auth_only: true
379 register: convert_sa_outbound
380
381 - name: get result of convert sa to outbound auth and change sAMAccountName
382 object_info:
383 identity: '{{ create_sa_no_dollar_check.distinguished_name }}'
384 properties:
385 - dnsHostName
386 - msDS-SupportedEncryptionTypes
387 - sAMAccountName
388 register: convert_sa_outbound_actual
389
390 - name: assert get result of convert sa to outbound auth and change sAMAccountName
391 assert:
392 that:
393 - convert_sa_outbound is changed
394 - convert_sa_outbound_actual.objects | length == 1
395 - convert_sa_outbound_actual.objects[0].DistinguishedName == create_sa_no_dollar.distinguished_name
396 - convert_sa_outbound_actual.objects[0].dnsHostName == None
397 - convert_sa_outbound_actual.objects[0]['msDS-SupportedEncryptionTypes'] == 16
398 - convert_sa_outbound_actual.objects[0].Name == 'MySA'
399 - convert_sa_outbound_actual.objects[0].ObjectGUID == create_sa_no_dollar.object_guid
400 - convert_sa_outbound_actual.objects[0].sAMAccountName == 'NewSATest$'
401
402 - name: convert sa to outbound auth and change sAMAccountName - idempotent
403 service_account:
404 name: MySA
405 state: present
406 kerberos_encryption_types:
407 remove:
408 - aes128
409 - des
410 sam_account_name: NewSATest
411 outbound_auth_only: true
412 register: convert_sa_outbound_again
413
414 - name: assert convert sa to outbound auth and change sAMAccountName - idempotent
415 assert:
416 that:
417 - not convert_sa_outbound_again is changed
418
419 - name: change sa details - check
420 service_account:
421 identity: NewSATest$
422 state: present
423 allowed_to_retrieve_password:
424 add:
425 - Domain Users
426 remove:
427 - name: Domain Admins
428 - Administrators
429 enabled: false
430 kerberos_encryption_types:
431 set: []
432 spn:
433 set:
434 - HTTP/SPN
435 - HTTP/SPN2
436 trusted_for_delegation: true
437 upn: saUPN@{{ setup_domain_info.output[0].dnsHostName }}
438 register: change_sa_check
439 check_mode: true
440
441 - name: get result of change sa details - check
442 ansible.windows.win_powershell:
443 parameters:
444 Identity: '{{ object_identity }}'
445 Properties:
446 - DistinguishedName
447 - DNSHostName
448 - Enabled
449 - KerberosEncryptionType
450 - Name
451 - ObjectGUID
452 - PrincipalsAllowedToRetrieveManagedPassword
453 - ServicePrincipalName
454 - SID
455 - SamAccountName
456 - TrustedForDelegation
457 - UserPrincipalName
458 script: |
459 param ($Identity, $Properties)
460
461 Get-ADServiceAccount -Identity $Identity -Properties $Properties |
462 Select-Object -Property $Properties
463 register: change_sa_check_actual
464
465 - name: assert change sa details - check
466 assert:
467 that:
468 - change_sa_check is changed
469 - change_sa_check_actual.output[0].DNSHostName == None
470 - change_sa_check_actual.output[0].DistinguishedName == change_sa_check.distinguished_name
471 - change_sa_check_actual.output[0].Enabled == true
472 - change_sa_check_actual.output[0].KerberosEncryptionType == [16]
473 - change_sa_check_actual.output[0].Name == "MySA"
474 - change_sa_check_actual.output[0].ObjectGUID == object_identity
475 - change_sa_check_actual.output[0].PrincipalsAllowedToRetrieveManagedPassword == []
476 - change_sa_check_actual.output[0].SID.Value == change_sa_check.sid
477 - change_sa_check_actual.output[0].SamAccountName == "NewSATest$"
478 - change_sa_check_actual.output[0].ServicePrincipalName == []
479 - change_sa_check_actual.output[0].TrustedForDelegation == false
480 - change_sa_check_actual.output[0].UserPrincipalName == None
481
482 - name: change sa details
483 service_account:
484 identity: NewSATest$
485 state: present
486 allowed_to_retrieve_password:
487 add:
488 - Domain Users
489 remove:
490 - name: Domain Admins
491 - Administrators
492 enabled: false
493 kerberos_encryption_types:
494 set: []
495 spn:
496 set:
497 - HTTP/SPN
498 - HTTP/SPN2
499 trusted_for_delegation: true
500 upn: saUPN@{{ setup_domain_info.output[0].dnsHostName }}
501 register: change_sa
502
503 - name: get result of change sa details
504 ansible.windows.win_powershell:
505 parameters:
506 Identity: '{{ object_identity }}'
507 Properties:
508 - DistinguishedName
509 - DNSHostName
510 - Enabled
511 - KerberosEncryptionType
512 - Name
513 - ObjectGUID
514 - PrincipalsAllowedToRetrieveManagedPassword
515 - ServicePrincipalName
516 - SID
517 - SamAccountName
518 - TrustedForDelegation
519 - UserPrincipalName
520 script: |
521 param ($Identity, $Properties)
522
523 Get-ADServiceAccount -Identity $Identity -Properties $Properties |
524 Select-Object -Property $Properties
525 register: change_sa_actual
526
527 - name: assert change sa details
528 assert:
529 that:
530 - change_sa is changed
531 - change_sa_actual.output[0].DNSHostName == None
532 - change_sa_actual.output[0].DistinguishedName == change_sa.distinguished_name
533 - change_sa_actual.output[0].Enabled == false
534 - change_sa_actual.output[0].KerberosEncryptionType == [0]
535 - change_sa_actual.output[0].Name == "MySA"
536 - change_sa_actual.output[0].ObjectGUID == object_identity
537 - change_sa_actual.output[0].PrincipalsAllowedToRetrieveManagedPassword == ["CN=Domain Users,CN=Users," ~ setup_domain_info.output[0].defaultNamingContext]
538 - change_sa_actual.output[0].SID.Value == change_sa.sid
539 - change_sa_actual.output[0].SamAccountName == "NewSATest$"
540 - change_sa_actual.output[0].ServicePrincipalName | length == 2
541 - '"HTTP/SPN" in change_sa_actual.output[0].ServicePrincipalName'
542 - '"HTTP/SPN2" in change_sa_actual.output[0].ServicePrincipalName'
543 - change_sa_actual.output[0].TrustedForDelegation == true
544 - change_sa_actual.output[0].UserPrincipalName == "saUPN@" ~ setup_domain_info.output[0].dnsHostName
545
546 - name: change sa details - idempotent
547 service_account:
548 identity: NewSATest$
549 state: present
550 allowed_to_retrieve_password:
551 add:
552 - Domain Users
553 remove:
554 - name: Domain Admins
555 - Administrators
556 enabled: false
557 kerberos_encryption_types:
558 set: []
559 spn:
560 set:
561 - HTTP/SPN
562 - HTTP/SPN2
563 trusted_for_delegation: true
564 upn: saUPN@{{ setup_domain_info.output[0].dnsHostName }}
565 register: change_sa_again
566
567 - name: assert change sa details - idempotent
568 assert:
569 that:
570 - not change_sa_again is changed
571
572 - name: convert sa to service auth and no $ suffix - check
573 service_account:
574 name: MySA
575 state: present
576 dns_hostname: MyHostName
577 sam_account_name: MySA
578 do_not_append_dollar_to_sam: true
579 allowed_to_retrieve_password:
580 add:
581 - Domain Admins
582 remove:
583 - name: Domain Users
584 - Administrators
585 enabled: true
586 kerberos_encryption_types:
587 add:
588 - aes128
589 remove:
590 - aes256
591 spn:
592 add:
593 - HTTP/SPN
594 - HTTP/spn3
595 remove:
596 - HTTP/SPN1
597 - HTTP/SPN2
598 trusted_for_delegation: false
599 upn: otherUPN@{{ setup_domain_info.output[0].dnsHostName }}
600 register: change_sa_check
601 check_mode: true
602
603 - name: get result of convert sa to service auth and no $ suffix - check
604 ansible.windows.win_powershell:
605 parameters:
606 Identity: '{{ object_identity }}'
607 Properties:
608 - DistinguishedName
609 - DNSHostName
610 - Enabled
611 - KerberosEncryptionType
612 - Name
613 - ObjectGUID
614 - PrincipalsAllowedToRetrieveManagedPassword
615 - ServicePrincipalName
616 - SID
617 - SamAccountName
618 - TrustedForDelegation
619 - UserPrincipalName
620 script: |
621 param ($Identity, $Properties)
622
623 Get-ADServiceAccount -Identity $Identity -Properties $Properties |
624 Select-Object -Property $Properties
625 register: change_sa_check_actual
626
627 - name: assert convert sa to service auth and no $ suffix - check
628 assert:
629 that:
630 - change_sa_check is changed
631 - change_sa_check_actual.output[0].DNSHostName == None
632 - change_sa_check_actual.output[0].DistinguishedName == change_sa.distinguished_name
633 - change_sa_check_actual.output[0].Enabled == false
634 - change_sa_check_actual.output[0].KerberosEncryptionType == [0]
635 - change_sa_check_actual.output[0].Name == "MySA"
636 - change_sa_check_actual.output[0].ObjectGUID == object_identity
637 - change_sa_check_actual.output[0].PrincipalsAllowedToRetrieveManagedPassword == ["CN=Domain Users,CN=Users," ~ setup_domain_info.output[0].defaultNamingContext]
638 - change_sa_check_actual.output[0].SID.Value == change_sa.sid
639 - change_sa_check_actual.output[0].SamAccountName == "NewSATest$"
640 - change_sa_check_actual.output[0].ServicePrincipalName | length == 2
641 - '"HTTP/SPN" in change_sa_check_actual.output[0].ServicePrincipalName'
642 - '"HTTP/SPN2" in change_sa_check_actual.output[0].ServicePrincipalName'
643 - change_sa_check_actual.output[0].TrustedForDelegation == true
644 - change_sa_check_actual.output[0].UserPrincipalName == "saUPN@" ~ setup_domain_info.output[0].dnsHostName
645
646 - name: convert sa to service auth and no $ suffix
647 service_account:
648 name: MySA
649 state: present
650 dns_hostname: MyHostName
651 sam_account_name: MySA
652 do_not_append_dollar_to_sam: true
653 allowed_to_retrieve_password:
654 add:
655 - Domain Admins
656 remove:
657 - name: Domain Users
658 - Administrators
659 enabled: true
660 kerberos_encryption_types:
661 add:
662 - aes128
663 remove:
664 - aes256
665 spn:
666 add:
667 - HTTP/SPN
668 - HTTP/spn3
669 remove:
670 - HTTP/SPN1
671 - HTTP/SPN2
672 trusted_for_delegation: false
673 upn: otherUPN@{{ setup_domain_info.output[0].dnsHostName }}
674 register: change_sa
675
676 - name: get result of convert sa to service auth and no $ suffix
677 ansible.windows.win_powershell:
678 parameters:
679 Identity: '{{ object_identity }}'
680 Properties:
681 - DistinguishedName
682 - DNSHostName
683 - Enabled
684 - KerberosEncryptionType
685 - Name
686 - ObjectGUID
687 - PrincipalsAllowedToRetrieveManagedPassword
688 - ServicePrincipalName
689 - SID
690 - SamAccountName
691 - TrustedForDelegation
692 - UserPrincipalName
693 script: |
694 param ($Identity, $Properties)
695
696 Get-ADServiceAccount -Identity $Identity -Properties $Properties |
697 Select-Object -Property $Properties
698 register: change_sa_actual
699
700 - name: assert convert sa to service auth and no $ suffix
701 assert:
702 that:
703 - change_sa is changed
704 - change_sa_actual.output[0].DNSHostName == 'MyHostName'
705 - change_sa_actual.output[0].DistinguishedName == change_sa.distinguished_name
706 - change_sa_actual.output[0].Enabled == true
707 - change_sa_actual.output[0].KerberosEncryptionType == [8]
708 - change_sa_actual.output[0].Name == "MySA"
709 - change_sa_actual.output[0].ObjectGUID == object_identity
710 - change_sa_actual.output[0].PrincipalsAllowedToRetrieveManagedPassword == ["CN=Domain Admins,CN=Users," ~ setup_domain_info.output[0].defaultNamingContext]
711 - change_sa_actual.output[0].SID.Value == change_sa.sid
712 - change_sa_actual.output[0].SamAccountName == "MySA"
713 - change_sa_actual.output[0].ServicePrincipalName | length == 2
714 - '"HTTP/SPN" in change_sa_actual.output[0].ServicePrincipalName'
715 - '"HTTP/spn3" in change_sa_actual.output[0].ServicePrincipalName'
716 - change_sa_actual.output[0].TrustedForDelegation == false
717 - change_sa_actual.output[0].UserPrincipalName == "otherUPN@" ~ setup_domain_info.output[0].dnsHostName
718
719 - name: convert sa to service auth and no $ suffix - idempotent
720 service_account:
721 name: MySA
722 state: present
723 dns_hostname: MyHostName
724 sam_account_name: MySA
725 do_not_append_dollar_to_sam: true
726 allowed_to_retrieve_password:
727 add:
728 - Domain Admins
729 remove:
730 - name: Domain Users
731 - Administrators
732 enabled: true
733 kerberos_encryption_types:
734 add:
735 - aes128
736 remove:
737 - aes256
738 spn:
739 add:
740 - HTTP/SPN
741 - HTTP/spn3
742 remove:
743 - HTTP/SPN1
744 - HTTP/SPN2
745 trusted_for_delegation: false
746 upn: otherUPN@{{ setup_domain_info.output[0].dnsHostName }}
747 register: change_sa_again
748
749 - name: assert convert sa to service auth and no $ suffix - idempotent
750 assert:
751 that:
752 - not change_sa_again is changed