| 1 |
--- |
| 2 |
- name: Test site exists, but stopped in case of duplicate web binding |
| 3 |
website: |
| 4 |
name: "{{ test_site_name }}" |
| 5 |
state: stopped |
| 6 |
physical_path: 'C:\inetpub\wwwroot' |
| 7 |
|
| 8 |
- name: Test virtual directory is absent (baseline) |
| 9 |
virtual_directory: |
| 10 |
state: absent |
| 11 |
site: "{{ test_site_name }}" |
| 12 |
name: "{{ test_vdir_name }}" |
| 13 |
|
| 14 |
- name: Create test virtual directory (check mode) |
| 15 |
virtual_directory: |
| 16 |
state: present |
| 17 |
site: "{{ test_site_name }}" |
| 18 |
name: "{{ test_vdir_name }}" |
| 19 |
physical_path: "{{ test_physical_path }}" |
| 20 |
register: result_check_mode |
| 21 |
check_mode: yes |
| 22 |
|
| 23 |
- name: Verify test virtual directory (check mode) |
| 24 |
virtual_directory_info: |
| 25 |
site: "{{ test_site_name }}" |
| 26 |
name: "{{ test_vdir_name }}" |
| 27 |
register: vdir_info_check_mode |
| 28 |
|
| 29 |
- assert: |
| 30 |
that: |
| 31 |
- 'result_check_mode.changed == true' |
| 32 |
- 'vdir_info_check_mode.exists == false' |
| 33 |
|
| 34 |
- name: Create test virtual directory |
| 35 |
virtual_directory: |
| 36 |
state: present |
| 37 |
site: "{{ test_site_name }}" |
| 38 |
name: "{{ test_vdir_name }}" |
| 39 |
physical_path: "{{ test_physical_path }}" |
| 40 |
register: result |
| 41 |
|
| 42 |
- assert: |
| 43 |
that: |
| 44 |
- 'result.changed == true' |
| 45 |
|
| 46 |
- name: Verify test virtual directory |
| 47 |
virtual_directory_info: |
| 48 |
site: "{{ test_site_name }}" |
| 49 |
name: "{{ test_vdir_name }}" |
| 50 |
register: vdir_info |
| 51 |
|
| 52 |
- assert: |
| 53 |
that: |
| 54 |
- 'vdir_info.directories[0].physical_path == test_physical_path' |
| 55 |
- 'vdir_info.directories[0].name == test_vdir_name' |
| 56 |
- 'vdir_info.directories[0].site == test_site_name' |
| 57 |
- 'vdir_info.directories[0].username == ""' |
| 58 |
|
| 59 |
- name: Create test virtual directory (idempotent) |
| 60 |
virtual_directory: |
| 61 |
state: present |
| 62 |
site: "{{ test_site_name }}" |
| 63 |
name: "{{ test_vdir_name }}" |
| 64 |
physical_path: "{{ test_physical_path }}" |
| 65 |
register: result |
| 66 |
|
| 67 |
- assert: |
| 68 |
that: |
| 69 |
- 'result.changed == false' |
| 70 |
|
| 71 |
- name: Set test virtual directory credentials |
| 72 |
virtual_directory: |
| 73 |
state: present |
| 74 |
site: "{{ test_site_name }}" |
| 75 |
name: "{{ test_vdir_name }}" |
| 76 |
connect_as: specific_user |
| 77 |
username: "{{ test_user }}" |
| 78 |
password: "{{ test_password }}" |
| 79 |
physical_path: "{{ test_physical_path }}" |
| 80 |
register: result |
| 81 |
|
| 82 |
- assert: |
| 83 |
that: |
| 84 |
- 'result.changed == true' |
| 85 |
|
| 86 |
- name: Verify test virtual directory credentials |
| 87 |
virtual_directory_info: |
| 88 |
site: "{{ test_site_name }}" |
| 89 |
name: "{{ test_vdir_name }}" |
| 90 |
register: vdir_info |
| 91 |
|
| 92 |
- assert: |
| 93 |
that: |
| 94 |
- 'vdir_info.directories[0].username == test_user' |
| 95 |
|
| 96 |
- name: Set test virtual directory credentials (idempotent) |
| 97 |
virtual_directory: |
| 98 |
state: present |
| 99 |
site: "{{ test_site_name }}" |
| 100 |
name: "{{ test_vdir_name }}" |
| 101 |
connect_as: specific_user |
| 102 |
username: "{{ test_user }}" |
| 103 |
password: "{{ test_password }}" |
| 104 |
physical_path: "{{ test_physical_path }}" |
| 105 |
register: result |
| 106 |
|
| 107 |
- assert: |
| 108 |
that: |
| 109 |
- 'result.changed == false' |
| 110 |
|
| 111 |
- name: Create test application temporary directory |
| 112 |
ansible.windows.win_tempfile: |
| 113 |
suffix: ".{{ test_app_name }}" |
| 114 |
state: directory |
| 115 |
register: test_app_tmp_dir |
| 116 |
|
| 117 |
- name: Create new test application |
| 118 |
web_application: |
| 119 |
name: "{{ test_app_name }}" |
| 120 |
site: "{{ test_site_name }}" |
| 121 |
physical_path: "{{ test_app_tmp_dir.path }}" |
| 122 |
state: present |
| 123 |
|
| 124 |
- name: Create application virtual directory and use pass through authentication in check mode |
| 125 |
virtual_directory: |
| 126 |
state: present |
| 127 |
site: "{{ test_site_name }}" |
| 128 |
name: "{{ test_vdir_name }}" |
| 129 |
physical_path: "{{ test_physical_path }}" |
| 130 |
connect_as: pass_through |
| 131 |
application: "{{ test_app_name }}" |
| 132 |
register: result_check_mode |
| 133 |
check_mode: True |
| 134 |
|
| 135 |
- name: Verify application virtual directory with pass through authentication in check mode |
| 136 |
virtual_directory_info: |
| 137 |
site: "{{ test_site_name }}" |
| 138 |
name: "{{ test_vdir_name }}" |
| 139 |
application: "{{ test_app_name }}" |
| 140 |
register: vdir_info_check_mode |
| 141 |
|
| 142 |
- assert: |
| 143 |
that: |
| 144 |
- 'result_check_mode.changed == true' |
| 145 |
- 'vdir_info_check_mode.exists == false' |
| 146 |
|
| 147 |
- name: Create application virtual directory and use pass through authentication |
| 148 |
virtual_directory: |
| 149 |
state: present |
| 150 |
site: "{{ test_site_name }}" |
| 151 |
name: "{{ test_vdir_name }}" |
| 152 |
physical_path: "{{ test_physical_path }}" |
| 153 |
connect_as: pass_through |
| 154 |
application: "{{ test_app_name }}" |
| 155 |
register: result |
| 156 |
|
| 157 |
- assert: |
| 158 |
that: |
| 159 |
- 'result.changed == true' |
| 160 |
|
| 161 |
- name: Verify application virtual directory with pass through authentication |
| 162 |
virtual_directory_info: |
| 163 |
site: "{{ test_site_name }}" |
| 164 |
name: "{{ test_vdir_name }}" |
| 165 |
application: "{{ test_app_name }}" |
| 166 |
register: vdir_info |
| 167 |
|
| 168 |
- assert: |
| 169 |
that: |
| 170 |
- 'vdir_info.directories[0].physical_path == test_physical_path' |
| 171 |
- 'vdir_info.directories[0].name == test_vdir_name' |
| 172 |
- 'vdir_info.directories[0].site == test_site_name' |
| 173 |
- vdir_info.directories[0].connect_as == 'pass_through' |
| 174 |
|
| 175 |
- name: Create application virtual directory and use pass through authentication (idempotent) |
| 176 |
virtual_directory: |
| 177 |
state: present |
| 178 |
site: "{{ test_site_name }}" |
| 179 |
name: "{{ test_vdir_name }}" |
| 180 |
physical_path: "{{ test_physical_path }}" |
| 181 |
connect_as: pass_through |
| 182 |
application: "{{ test_app_name }}" |
| 183 |
register: result |
| 184 |
|
| 185 |
- assert: |
| 186 |
that: |
| 187 |
- 'result.changed == false' |
| 188 |
|
| 189 |
- name: Delete application virtual directory and use pass through authentication (Check Mode) |
| 190 |
virtual_directory: |
| 191 |
state: absent |
| 192 |
site: "{{ test_site_name }}" |
| 193 |
name: "{{ test_vdir_name }}" |
| 194 |
physical_path: "{{ test_physical_path }}" |
| 195 |
connect_as: pass_through |
| 196 |
application: "{{ test_app_name }}" |
| 197 |
register: app_result |
| 198 |
check_mode: True |
| 199 |
|
| 200 |
- name: Verify application virtual directory and use pass through authentication (Check Mode) |
| 201 |
virtual_directory_info: |
| 202 |
site: "{{ test_site_name }}" |
| 203 |
name: "{{ test_vdir_name }}" |
| 204 |
application: "{{ test_app_name }}" |
| 205 |
register: app_vdir_info |
| 206 |
|
| 207 |
- assert: |
| 208 |
that: |
| 209 |
- 'app_result.changed == true' |
| 210 |
- 'app_vdir_info.exists == true' |
| 211 |
|
| 212 |
- name: Delete application virtual directory and use pass through authentication |
| 213 |
virtual_directory: |
| 214 |
state: absent |
| 215 |
site: "{{ test_site_name }}" |
| 216 |
name: "{{ test_vdir_name }}" |
| 217 |
physical_path: "{{ test_physical_path }}" |
| 218 |
connect_as: pass_through |
| 219 |
application: "{{ test_app_name }}" |
| 220 |
register: result |
| 221 |
|
| 222 |
- assert: |
| 223 |
that: |
| 224 |
- 'result.changed == true' |
| 225 |
|
| 226 |
- name: Verify virtual directory with pass through authentication do not exists |
| 227 |
virtual_directory_info: |
| 228 |
site: "{{ test_site_name }}" |
| 229 |
name: "{{ test_vdir_name }}" |
| 230 |
application: "{{ test_app_name }}" |
| 231 |
register: vdir_info |
| 232 |
|
| 233 |
- assert: |
| 234 |
that: |
| 235 |
- 'vdir_info.changed == false' |
| 236 |
|
| 237 |
- name: Delete virtual directory and use pass through authentication (idempotent) |
| 238 |
virtual_directory: |
| 239 |
state: absent |
| 240 |
site: "{{ test_site_name }}" |
| 241 |
name: "{{ test_vdir_name }}" |
| 242 |
physical_path: "{{ test_physical_path }}" |
| 243 |
connect_as: pass_through |
| 244 |
application: "{{ test_app_name }}" |
| 245 |
register: result |
| 246 |
|
| 247 |
- assert: |
| 248 |
that: |
| 249 |
- 'result.changed == false' |