ansible/test/integration/targets/win_iis_webbinding/tasks/main.yml
nwsparks 0a3da471f5 win_iis_webbinding rewrite (#33958)
* Begin rewrite of win_iis_webbinding
Add integration testing, check mode and idempotency
Add support for SNI
Fix replacing SSL cert on existing bindings

* finished up initial rewrite of win_iis_webbinding

* updated test to remove tests as filters

* updated win_iis_webbinding docs

* fix more doc/formatting issues win_iis_webbinding

* Removed string empty defaults for certs. Added a few new helpful
comments.

* Revert "Removed string empty defaults for certs. Added a few new helpful"

This reverts commit 48f35faea8.
2018-01-01 19:30:18 -05:00

62 lines
2 KiB
YAML

---
# Cannot use win_feature to install IIS on Server 2008.
# Run a brief check and skip hosts that don't support
# that operation
#seems "raw" is the only module that works on 2008 non-r2. win_command and win_shell both failed
- name: register os version (seems integration tests don't gather this fact)
raw: powershell.exe "gwmi Win32_OperatingSystem | select -expand version"
register: os_version
changed_when: False
- block:
- include_tasks: setup.yml
- include_tasks: http.yml
- include_tasks: https-lt6.2.yml
when: os_version.stdout_lines[0] | version_compare('6.2','lt')
- include_tasks: https-ge6.2.yml
when: os_version.stdout_lines[0] | version_compare('6.2','ge')
- include_tasks: failures.yml
always:
- name: get all websites from server
raw: powershell.exe "(get-website).name"
register: existing_sites
- name: ensure all sites are removed for clean testing
win_iis_website:
name: "{{ item }}"
state: absent
with_items:
- "{{ existing_sites.stdout_lines }}"
- name: cleanup certreq files
win_file:
path: "{{ item }}"
state: absent
with_items:
- c:\windows\temp\certreq1.txt
- c:\windows\temp\certreq2.txt
- c:\windows\temp\certreqwc.txt
- c:\windows\temp\certreqresp1.txt
- c:\windows\temp\certreqresp2.txt
- c:\windows\temp\certreqrespwc.txt
- name: remove certs
raw: 'remove-item cert:\localmachine\my\{{ item }} -force -ea silentlycontinue'
with_items:
- "{{ thumbprint1.stdout_lines[0] }}"
- "{{ thumbprint2.stdout_lines[0] }}"
- "{{ thumbprint_wc.stdout_lines[0] }}"
- name: remove IIS features after test
win_feature:
name: Web-Server
state: absent
includ_sub_features: True
include_management_tools: True
register: feature_uninstall
- name: reboot after feature install
win_reboot:
when: feature_uninstall.reboot_required
when: os_version.stdout_lines[0] | version_compare('6.1','gt')