1#!/usr/local/bin/python3.8 2# -*- coding: utf-8 -*- 3 4# Copyright: (c) 2017, Noah Sparks <nsparks@outlook.com> 5# Copyright: (c) 2017, Henrik Wallström <henrik@wallstroms.nu> 6# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 8DOCUMENTATION = r''' 9--- 10module: win_iis_webbinding 11short_description: Configures a IIS Web site binding 12description: 13 - Creates, removes and configures a binding to an existing IIS Web site. 14options: 15 name: 16 description: 17 - Names of web site. 18 type: str 19 required: yes 20 aliases: [ website ] 21 state: 22 description: 23 - State of the binding. 24 type: str 25 choices: [ absent, present ] 26 default: present 27 port: 28 description: 29 - The port to bind to / use for the new site. 30 type: str 31 default: 80 32 ip: 33 description: 34 - The IP address to bind to / use for the new site. 35 type: str 36 default: '*' 37 host_header: 38 description: 39 - The host header to bind to / use for the new site. 40 - If you are creating/removing a catch-all binding, omit this parameter rather than defining it as '*'. 41 type: str 42 protocol: 43 description: 44 - The protocol to be used for the Web binding (usually HTTP, HTTPS, or FTP). 45 type: str 46 default: http 47 certificate_hash: 48 description: 49 - Certificate hash (thumbprint) for the SSL binding. The certificate hash is the unique identifier for the certificate. 50 type: str 51 certificate_store_name: 52 description: 53 - Name of the certificate store where the certificate for the binding is located. 54 type: str 55 default: my 56 ssl_flags: 57 description: 58 - This parameter is only valid on Server 2012 and newer. 59 - Primarily used for enabling and disabling server name indication (SNI). 60 - Set to C(0) to disable SNI. 61 - Set to C(1) to enable SNI. 62 type: str 63seealso: 64- module: community.windows.win_iis_virtualdirectory 65- module: community.windows.win_iis_webapplication 66- module: community.windows.win_iis_webapppool 67- module: community.windows.win_iis_website 68author: 69 - Noah Sparks (@nwsparks) 70 - Henrik Wallström (@henrikwallstrom) 71''' 72 73EXAMPLES = r''' 74- name: Add a HTTP binding on port 9090 75 community.windows.win_iis_webbinding: 76 name: Default Web Site 77 port: 9090 78 state: present 79 80- name: Remove the HTTP binding on port 9090 81 community.windows.win_iis_webbinding: 82 name: Default Web Site 83 port: 9090 84 state: absent 85 86- name: Remove the default http binding 87 community.windows.win_iis_webbinding: 88 name: Default Web Site 89 port: 80 90 ip: '*' 91 state: absent 92 93- name: Add a HTTPS binding 94 community.windows.win_iis_webbinding: 95 name: Default Web Site 96 protocol: https 97 port: 443 98 ip: 127.0.0.1 99 certificate_hash: B0D0FA8408FC67B230338FCA584D03792DA73F4C 100 state: present 101 102- name: Add a HTTPS binding with host header and SNI enabled 103 community.windows.win_iis_webbinding: 104 name: Default Web Site 105 protocol: https 106 port: 443 107 host_header: test.com 108 ssl_flags: 1 109 certificate_hash: D1A3AF8988FD32D1A3AF8988FD323792DA73F4C 110 state: present 111''' 112 113RETURN = r''' 114website_state: 115 description: 116 - The state of the website being targetted 117 - Can be helpful in case you accidentally cause a binding collision 118 which can result in the targetted site being stopped 119 returned: always 120 type: str 121 sample: "Started" 122operation_type: 123 description: 124 - The type of operation performed 125 - Can be removed, updated, matched, or added 126 returned: on success 127 type: str 128 sample: "removed" 129binding_info: 130 description: 131 - Information on the binding being manipulated 132 returned: on success 133 type: dict 134 sample: |- 135 "binding_info": { 136 "bindingInformation": "127.0.0.1:443:", 137 "certificateHash": "FF3910CE089397F1B5A77EB7BAFDD8F44CDE77DD", 138 "certificateStoreName": "MY", 139 "hostheader": "", 140 "ip": "127.0.0.1", 141 "port": 443, 142 "protocol": "https", 143 "sslFlags": "not supported" 144 } 145''' 146