Debian Codegraph @

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

raw symbols SCIP
1 - name: create test folders
2 ansible.windows.win_file:
3 path: 'C:\ansible_testing\{{ item }}'
4 state: directory
5 loop:
6 - DB
7 - LogPath
8 - SysVol
9
10 - name: create tree domain - check mode
11 domain_child:
12 dns_domain_name: '{{ child_domain_name }}'
13 parent_domain_name: '{{ domain_realm }}'
14 domain_type: tree
15 domain_admin_user: '{{ domain_user_upn }}'
16 domain_admin_password: '{{ domain_password }}'
17 safe_mode_password: '{{ domain_password }}'
18 domain_mode: WinThreshold
19 database_path: C:\ansible_testing\DB
20 log_path: C:\ansible_testing\LogPath
21 sysvol_path: C:\ansible_testing\SysVol
22 reboot: true
23 register: to_tree_check
24 check_mode: true
25
26 - name: get result of promote to tree domain - check mode
27 ansible.windows.win_powershell:
28 script: '{{ get_role_script }}'
29 register: to_tree_check_actual
30
31 - name: assert promote to domain - check mode
32 assert:
33 that:
34 - to_tree_check is changed
35 - not to_tree_check.reboot_required
36 - to_tree_check_actual.output[0]["Domain"] == None
37 - to_tree_check_actual.output[0]["DomainRole"] == "StandaloneServer"
38
39 - name: change hostname to have a pending change before promotion
40 ansible.windows.win_hostname:
41 name: '{{ new_hostname }}'
42
43 - name: create tree domain with pending reboot
44 domain_child:
45 dns_domain_name: '{{ child_domain_name }}'
46 parent_domain_name: '{{ domain_realm }}'
47 domain_type: tree
48 domain_admin_user: '{{ domain_user_upn }}'
49 domain_admin_password: '{{ domain_password }}'
50 safe_mode_password: '{{ domain_password }}'
51 domain_mode: WinThreshold
52 database_path: C:\ansible_testing\DB
53 log_path: C:\ansible_testing\LogPath
54 sysvol_path: C:\ansible_testing\SysVol
55 reboot: true
56 register: to_tree
57
58 - name: get result of promote to domain with pending reboot
59 ansible.windows.win_powershell:
60 script: '{{ get_role_script }}'
61 register: to_tree_actual
62
63 - name: assert promote to domain with pending reboot
64 assert:
65 that:
66 - to_tree is changed
67 - not to_tree.reboot_required
68 - to_tree_actual.output[0]["Domain"] == child_domain_name
69 - to_tree_actual.output[0]["DomainRole"] == "PrimaryDC"
70 - to_tree_actual.output[0]["HostName"] == new_hostname | upper
71
72 - name: create tree domain - idempotent
73 domain_child:
74 dns_domain_name: '{{ child_domain_name }}'
75 parent_domain_name: '{{ domain_realm }}'
76 domain_type: tree
77 domain_admin_user: '{{ domain_user_upn }}'
78 domain_admin_password: '{{ domain_password }}'
79 safe_mode_password: '{{ domain_password }}'
80 domain_mode: WinThreshold
81 database_path: C:\ansible_testing\DB
82 log_path: C:\ansible_testing\LogPath
83 sysvol_path: C:\ansible_testing\SysVol
84 reboot: true
85 register: to_tree_again
86
87 - name: assert create tree domain - idempotent
88 assert:
89 that:
90 - not to_tree_again is changed
91 - not to_tree_again.reboot_required