community.windows.win_iis_webbinding (2.2.0) — module

Configures a IIS Web site binding

Authors: Noah Sparks (@nwsparks), Henrik Wallström (@henrikwallstrom)

Install collection

Install with ansible-galaxy collection install community.windows:==2.2.0


Add to requirements.yml

  collections:
    - name: community.windows
      version: 2.2.0

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add a HTTP binding on port 9090
  community.windows.win_iis_webbinding:
    name: Default Web Site
    port: 9090
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove the HTTP binding on port 9090
  community.windows.win_iis_webbinding:
    name: Default Web Site
    port: 9090
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove the default http binding
  community.windows.win_iis_webbinding:
    name: Default Web Site
    port: 80
    ip: '*'
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add a HTTPS binding
  community.windows.win_iis_webbinding:
    name: Default Web Site
    protocol: https
    port: 443
    ip: 127.0.0.1
    certificate_hash: B0D0FA8408FC67B230338FCA584D03792DA73F4C
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add a HTTPS binding with host header and SNI enabled
  community.windows.win_iis_webbinding:
    name: Default Web Site
    protocol: https
    port: 443
    host_header: test.com
    ssl_flags: 1
    certificate_hash: D1A3AF8988FD32D1A3AF8988FD323792DA73F4C
    state: present

Inputs

    
ip:
    default: '*'
    description:
    - The IP address to bind to / use for the new site.
    type: str

name:
    aliases:
    - website
    description:
    - Names of web site.
    required: true
    type: str

port:
    default: 80
    description:
    - The port to bind to / use for the new site.
    type: int

state:
    choices:
    - absent
    - present
    default: present
    description:
    - State of the binding.
    type: str

protocol:
    default: http
    description:
    - The protocol to be used for the Web binding (usually HTTP, HTTPS, or FTP).
    type: str

ssl_flags:
    description:
    - 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.
    type: str

host_header:
    description:
    - 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 '*'.
    type: str

certificate_hash:
    description:
    - Certificate hash (thumbprint) for the SSL binding. The certificate hash is the unique
      identifier for the certificate.
    type: str

certificate_store_name:
    default: my
    description:
    - Name of the certificate store where the certificate for the binding is located.
    type: str

Outputs

binding_info:
  description:
  - Information on the binding being manipulated
  returned: on success
  sample: "\"binding_info\": {\n  \"bindingInformation\": \"127.0.0.1:443:\",\n  \"\
    certificateHash\": \"FF3910CE089397F1B5A77EB7BAFDD8F44CDE77DD\",\n  \"certificateStoreName\"\
    : \"MY\",\n  \"hostheader\": \"\",\n  \"ip\": \"127.0.0.1\",\n  \"port\": 443,\n\
    \  \"protocol\": \"https\",\n  \"sslFlags\": \"not supported\"\n}"
  type: dict
operation_type:
  description:
  - The type of operation performed
  - Can be removed, updated, matched, or added
  returned: on success
  sample: removed
  type: str
website_state:
  description:
  - 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
  returned: always
  sample: Started
  type: str

See also