1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/win_dsc/tasks/destructive.yml
Jordan Borean 978a979566
win_dsc: improved parameter handling (#31556)
* win_dsc: improved parameter handling

* removed uneeded try/catch leftover from testing

* removed undeed return values

* added custom DSC to fully test out casting

* fix up codestyle issues

* using new Requires ps version check

* fixed up error message check on earlier ps version
2017-11-06 09:44:04 +10:00

135 lines
3.6 KiB
YAML

# these tests are destructive and can be run manually on a throwaway host
# set test_win_dsc_run_desctructive: yes in default/main.yml
---
- name: ensure IIS features are installed
win_feature:
name: Web-Server
include_sub_features: yes
include_management_tools: no
state: present
- name: install xWebAdministration module
win_psmodule:
name: xWebAdministration
state: present
- name: ensure IIS website does not exists
win_iis_website:
name: Ansible DSC Test
state: absent
- name: get certificate hash for IIS test
win_shell: (Get-ChildItem -Path Cert:\LocalMachine\My)[0].Thumbprint
register: win_dsc_cert_thumbprint
- name: create an IIS website with auth and binding info (check mode)
win_dsc:
resource_name: xWebSite
Ensure: Present
Name: Ansible DSC Test
State: Started
PhysicalPath: C:\inetpub\wwwroot
BindingInfo:
- Protocol: https
Port: 8443
CertificateStoreName: MY
CertificateThumbprint: '{{win_dsc_cert_thumbprint.stdout_lines[0]}}'
HostName: DSCTest
IPAddress: '*'
SSLFlags: '1'
- Protocol: http
Port: 8888
IPAddress: '*'
AuthenticationInfo:
Anonymous: yes
Basic: no
Digest: no
Windows: yes
register: win_dsc_iis_check
check_mode: yes
- name: get result of create an IIS website (check mode)
test_win_dsc_iis_info:
name: Ansible DSC Test
register: win_dsc_iis_check_result
- name: assert results of create an IIS website (check mode)
assert:
that:
- win_dsc_iis_check|changed
- win_dsc_iis_check_result.exists == False
- name: create an IIS website with auth and binding info
win_dsc:
resource_name: xWebSite
Ensure: Present
Name: Ansible DSC Test
State: Started
PhysicalPath: C:\inetpub\wwwroot
BindingInfo:
- Protocol: https
Port: 8443
CertificateStoreName: MY
CertificateThumbprint: '{{win_dsc_cert_thumbprint.stdout_lines[0]}}'
HostName: Test
IPAddress: '*'
SSLFlags: '1'
- Protocol: http
Port: 8888
IPAddress: '*'
AuthenticationInfo:
Anonymous: yes
Basic: no
Digest: no
Windows: yes
register: win_dsc_iis
- name: get result of create an IIS website
test_win_dsc_iis_info:
name: Ansible DSC Test
register: win_dsc_iis_result
- name: assert results of create an IIS website
assert:
that:
- win_dsc_iis|changed
- win_dsc_iis_result.exists == True
- win_dsc_iis_result.auth.anonymous == True
- win_dsc_iis_result.auth.basic == False
- win_dsc_iis_result.auth.digest == False
- win_dsc_iis_result.auth.windows == True
- win_dsc_iis_result.http.binding == "*:8888:"
- win_dsc_iis_result.https.binding == "*:8443:Test"
- win_dsc_iis_result.https.hash == '{{win_dsc_cert_thumbprint.stdout_lines[0]}}'
- win_dsc_iis_result.https.sslFlags == 1
- win_dsc_iis_result.https.store == "MY"
- name: create an IIS website with auth and binding info (idempotent)
win_dsc:
resource_name: xWebSite
Ensure: Present
Name: Ansible DSC Test
State: Started
PhysicalPath: C:\inetpub\wwwroot
BindingInfo:
- Protocol: https
Port: 8443
CertificateStoreName: MY
CertificateThumbprint: '{{win_dsc_cert_thumbprint.stdout_lines[0]}}'
HostName: Test
IPAddress: '*'
SSLFlags: '1'
- Protocol: http
Port: 8888
IPAddress: '*'
AuthenticationInfo:
Anonymous: yes
Basic: no
Digest: no
Windows: yes
register: win_dsc_iis_again
- name: assert results of create an IIS website (idempotent)
assert:
that:
- not win_dsc_iis_again|changed