win_iis_webbinding – Configures a IIS Web site binding

New in version 2.0.

Synopsis

  • Creates, removes and configures a binding to an existing IIS Web site.

Parameters

Parameter Choices/Defaults Comments
certificate_hash
-
Certificate hash (thumbprint) for the SSL binding. The certificate hash is the unique identifier for the certificate.
certificate_store_name
-
Default:
"my"
Name of the certificate store where the certificate for the binding is located.
host_header
-
The host header to bind to / use for the new site.
If you are creating/removing a catch-all binding, omit this parameter rather than defining it as '*'.
ip
-
Default:
"*"
The IP address to bind to / use for the new site.
name
- / required
Names of web site.

aliases: website
port
-
Default:
80
The port to bind to / use for the new site.
protocol
-
Default:
"http"
The protocol to be used for the Web binding (usually HTTP, HTTPS, or FTP).
ssl_flags
-
added in 2.5
This parameter is only valid on Server 2012 and newer.
Primarily used for enabling and disabling server name indication (SNI).
Set to c(0) to disable SNI.
Set to c(1) to enable SNI.
state
-
    Choices:
  • absent
  • present ←
State of the binding.

Examples

- name: Add a HTTP binding on port 9090
  win_iis_webbinding:
    name: Default Web Site
    port: 9090
    state: present

- name: Remove the HTTP binding on port 9090
  win_iis_webbinding:
    name: Default Web Site
    port: 9090
    state: absent

- name: Remove the default http binding
  win_iis_webbinding:
    name: Default Web Site
    port: 80
    ip: '*'
    state: absent

- name: Add a HTTPS binding
  win_iis_webbinding:
    name: Default Web Site
    protocol: https
    port: 443
    ip: 127.0.0.1
    certificate_hash: B0D0FA8408FC67B230338FCA584D03792DA73F4C
    state: present

- name: Add a HTTPS binding with host header and SNI enabled
  win_iis_webbinding:
    name: Default Web Site
    protocol: https
    port: 443
    host_header: test.com
    ssl_flags: 1
    certificate_hash: D1A3AF8988FD32D1A3AF8988FD323792DA73F4C
    state: present

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
binding_info
dictionary
added in 2.5
on success
Information on the binding being manipulated

Sample:
"binding_info": { "bindingInformation": "127.0.0.1:443:", "certificateHash": "FF3910CE089397F1B5A77EB7BAFDD8F44CDE77DD", "certificateStoreName": "MY", "hostheader": "", "ip": "127.0.0.1", "port": 443, "protocol": "https", "sslFlags": "not supported" }
operation_type
string
added in 2.5
on success
The type of operation performed
Can be removed, updated, matched, or added

Sample:
removed
website_state
string
added in 2.5
always
The state of the website being targetted
Can be helpful in case you accidentally cause a binding collision which can result in the targetted site being stopped

Sample:
Started


Status

Authors

  • Noah Sparks (@nwsparks)
  • Henrik Wallström

Hint

If you notice any issues in this documentation you can edit this document to improve it.