2018-01-19 01:00:35 +01:00
|
|
|
- name: failure check define * for host header
|
2018-01-02 01:30:18 +01:00
|
|
|
win_iis_webbinding:
|
|
|
|
name: "{{ test_iis_site_name }}"
|
|
|
|
state: present
|
2018-01-19 01:00:35 +01:00
|
|
|
host_header: '*'
|
|
|
|
protocol: http
|
2018-01-02 01:30:18 +01:00
|
|
|
ip: '*'
|
|
|
|
register: failure
|
2018-01-19 01:00:35 +01:00
|
|
|
failed_when: failure.msg != "To make or remove a catch-all binding, please omit the host_header parameter entirely rather than specify host_header *"
|
2018-01-02 01:30:18 +01:00
|
|
|
|
|
|
|
- debug:
|
|
|
|
var: failure
|
|
|
|
verbosity: 1
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- 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 }}"
|
|
|
|
|
2018-01-19 01:00:35 +01:00
|
|
|
- name: add testremove site
|
2018-01-02 01:30:18 +01:00
|
|
|
win_iis_website:
|
2018-01-19 01:00:35 +01:00
|
|
|
name: testremove
|
2018-01-02 01:30:18 +01:00
|
|
|
state: started
|
|
|
|
physical_path: c:\inetpub\wwwroot
|
|
|
|
|
2018-01-19 01:00:35 +01:00
|
|
|
- name: add bindings to testremove
|
2018-01-02 01:30:18 +01:00
|
|
|
win_iis_webbinding:
|
2018-01-19 01:00:35 +01:00
|
|
|
name: testremove
|
|
|
|
ip: "{{ item.ip }}"
|
|
|
|
port: "{{ item.port }}"
|
|
|
|
with_items:
|
|
|
|
- {ip: 127.0.0.1, port: 80}
|
|
|
|
- {ip: '*', port: 80}
|
2018-01-02 01:30:18 +01:00
|
|
|
|
2018-01-19 01:00:35 +01:00
|
|
|
- name: remove ip * binding from testremove
|
2018-01-02 01:30:18 +01:00
|
|
|
win_iis_webbinding:
|
2018-01-19 01:00:35 +01:00
|
|
|
name: testremove
|
|
|
|
state: absent
|
|
|
|
port: 80
|
|
|
|
ip: '*'
|
|
|
|
|
|
|
|
- name: get the remaining binding from testremove
|
|
|
|
test_get_webbindings:
|
|
|
|
name: testremove
|
|
|
|
port: 80
|
2018-01-02 01:30:18 +01:00
|
|
|
ip: 127.0.0.1
|
2018-01-19 01:00:35 +01:00
|
|
|
register: test_result
|
2018-01-02 01:30:18 +01:00
|
|
|
|
|
|
|
- debug:
|
2018-01-19 01:00:35 +01:00
|
|
|
var: test_result
|
2018-01-02 01:30:18 +01:00
|
|
|
verbosity: 1
|
|
|
|
|
2018-01-19 01:00:35 +01:00
|
|
|
- name: assert that remove *:80 doesn't also remove 127.0.0.1:80
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- test_result.binding.ip == '127.0.0.1'
|
|
|
|
- test_result.binding.port == 80
|
|
|
|
|
2018-01-02 01:30:18 +01:00
|
|
|
always:
|
|
|
|
- name: remove websites
|
|
|
|
win_iis_website:
|
2018-01-19 01:00:35 +01:00
|
|
|
name: testremove
|
2018-01-02 01:30:18 +01:00
|
|
|
state: absent
|