ansible/test/integration/targets/win_iis_webapppool/tasks/main.yml
Jordan Borean f0a0e5674c win_iis_webapppool: tests, check_mode, bugfixes (#25869)
* win_iis_webapppool: Added integration testa and cleanup

* Updated docs and tests

* fixes from linter

* fixed up typo in docs
2017-08-15 01:14:39 -04:00

61 lines
1.5 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
- name: check if win_feature will work on test host
win_command: powershell.exe "Get-WindowsFeature"
register: module_available
failed_when: False
# Run actual tests
- block:
# Setup for tests
- name: this is too finicky reboot before feature install
win_reboot:
- name: ensure IIS features are installed
win_feature:
name: Web-Server
state: present
includ_sub_features: True
include_management_tools: True
register: feature_install
- name: reboot after feature install
win_reboot:
when: feature_install.reboot_required
- name: set version of IIS for tests
win_file_version:
path: C:\Windows\System32\inetsrv\w3wp.exe
register: iis_version
- name: ensure test pool is deleted as a baseline
win_iis_webapppool:
name: '{{test_iis_webapppool_name}}'
state: absent
# Tests
- name: run tests on hosts that support it
include_tasks: tests.yml
always:
# Cleanup
- name: ensure test pool is deleted
win_iis_webapppool:
name: '{{test_iis_webapppool_name}}'
state: absent
- 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: module_available.rc == 0