Debian Codegraph @

ansible_collections/microsoft/ad/tests/integration/targets/domain_child/tasks/main_child.yml

raw symbols SCIP
1 - name: create child domain - check mode
2 domain_child:
3 dns_domain_name: '{{ child_domain_name }}'
4 domain_admin_user: '{{ domain_user_upn }}'
5 domain_admin_password: '{{ domain_password }}'
6 safe_mode_password: '{{ domain_password }}'
7 reboot: true
8 register: to_domain_check
9 check_mode: true
10
11 - name: get result of promote to domain - check mode
12 ansible.windows.win_powershell:
13 script: '{{ get_role_script }}'
14 register: to_domain_check_actual
15
16 - name: assert promote to domain - check mode
17 assert:
18 that:
19 - to_domain_check is changed
20 - to_domain_check_actual.output[0]["Domain"] == None
21 - to_domain_check_actual.output[0]["DomainRole"] == "StandaloneServer"
22
23 - name: change hostname to have a pending change before promotion
24 ansible.windows.win_hostname:
25 name: '{{ new_hostname }}'
26
27 - name: create child domain with pending reboot
28 domain_child:
29 dns_domain_name: '{{ child_domain_name }}'
30 domain_admin_user: '{{ domain_user_upn }}'
31 domain_admin_password: '{{ domain_password }}'
32 safe_mode_password: '{{ domain_password }}'
33 reboot: true
34 register: to_domain
35
36 - name: get result of promote to domain with pending reboot
37 ansible.windows.win_powershell:
38 script: '{{ get_role_script }}'
39 register: to_domain_actual
40
41 - name: assert promote to domain with pending reboot
42 assert:
43 that:
44 - to_domain is changed
45 - to_domain_actual.output[0]["Domain"] == child_domain_name
46 - to_domain_actual.output[0]["DomainRole"] == "PrimaryDC"
47 - to_domain_actual.output[0]["HostName"] == new_hostname | upper
48
49 - name: create child domain - idempotent
50 domain_child:
51 dns_domain_name: '{{ child_domain_name }}'
52 domain_admin_user: '{{ domain_user_upn }}'
53 domain_admin_password: '{{ domain_password }}'
54 safe_mode_password: '{{ domain_password }}'
55 reboot: true
56 register: to_domain_again
57
58 - name: assert create child domain - idempotent
59 assert:
60 that:
61 - not to_domain_again is changed
62
63 - name: fail to change domain of host
64 domain_child:
65 dns_domain_name: bogus.local
66 domain_admin_user: '{{ domain_user_upn }}'
67 domain_admin_password: '{{ domain_password }}'
68 safe_mode_password: '{{ domain_password }}'
69 reboot: true
70 register: change_domain_fail
71 failed_when:
72 - change_domain_fail.msg != "Host is already a domain controller in another domain " ~ child_domain_name
73
74 - name: fail with parent_domain_name with domain_type mode
75 domain_child:
76 dns_domain_name: '{{ child_domain_name }}'
77 domain_admin_user: '{{ domain_user_upn }}'
78 domain_admin_password: '{{ domain_password }}'
79 safe_mode_password: '{{ domain_password }}'
80 parent_domain_name: other
81 reboot: true
82 register: invalid_parent
83 failed_when:
84 - invalid_parent.msg != "parent_domain_name must not be set when domain_type=child"
85
86 - name: fail with invalid domain_mode
87 domain_child:
88 dns_domain_name: bogus.local
89 parent_domain_name: '{{ domain_realm }}'
90 domain_admin_user: '{{ domain_user_upn }}'
91 domain_admin_password: '{{ domain_password }}'
92 safe_mode_password: '{{ domain_password }}'
93 domain_mode: Invalid
94 reboot: true
95 register: change_domain_invalid_mode
96 failed_when:
97 - >-
98 change_domain_invalid_mode.msg.startswith("The parameter 'domain_mode' does not accept 'Invalid', please use one of: ")