| 1 |
--- |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
DOCUMENTATION: |
| 6 |
module: website |
| 7 |
short_description: Configures an IIS website |
| 8 |
description: |
| 9 |
- Creates, removes, and configures an IIS website. |
| 10 |
requirements: |
| 11 |
- IISAdministration PowerShell module |
| 12 |
options: |
| 13 |
application_pool: |
| 14 |
description: |
| 15 |
- Specifies the application pool in which the website runs. |
| 16 |
- The application pool must already exist - otherwise the website will not start. |
| 17 |
type: str |
| 18 |
bindings: |
| 19 |
description: |
| 20 |
- Specifies the website bindings to add, remove or set. |
| 21 |
- The combination of C(ip:port:hostname) is the binding unique identifier. |
| 22 |
- The binding C(ip:port) must be available and not used by any other website on the server. |
| 23 |
- To clear all website bindings, use O(bindings.set) with an empty list. |
| 24 |
type: dict |
| 25 |
default: {} |
| 26 |
suboptions: |
| 27 |
add: |
| 28 |
description: |
| 29 |
- Specifies a list of bindings to add to the website. |
| 30 |
type: list |
| 31 |
elements: dict |
| 32 |
suboptions: |
| 33 |
hostname: |
| 34 |
description: |
| 35 |
- The website binding hostname (DNS). |
| 36 |
- Mandatory if O(bindings.add.use_sni=true) or O(bindings.add.use_ccs=true). |
| 37 |
type: str |
| 38 |
ip: |
| 39 |
description: The website binding listen IP. |
| 40 |
type: str |
| 41 |
port: |
| 42 |
description: The website binding listen port. |
| 43 |
type: int |
| 44 |
protocol: |
| 45 |
description: The website used protocol (http, https). |
| 46 |
type: str |
| 47 |
default: http |
| 48 |
choices: ["http", "https"] |
| 49 |
use_sni: |
| 50 |
description: |
| 51 |
- Require Server Name Indication (SNI) for SSL certificates. |
| 52 |
- Can be used only if protocol is https. |
| 53 |
- When O(bindings.add.use_sni=true), the O(bindings.add.hostname) value must be set. |
| 54 |
type: bool |
| 55 |
use_ccs: |
| 56 |
description: |
| 57 |
- Use Centralized Certificate Store (CCS) for SSL certificates. |
| 58 |
- Can be used only if O(bindings.add.protocol=https). |
| 59 |
- When O(bindings.add.use_ccs=true), the O(bindings.add.hostname) value must be set. |
| 60 |
- If V(true), O(bindings.add.certificate_hash) should not be used. |
| 61 |
type: bool |
| 62 |
certificate_hash: |
| 63 |
description: |
| 64 |
- Certificate hash (thumbprint) for the SSL binding. The certificate hash is the unique identifier for the certificate. |
| 65 |
- You can only provide a certificate thumbprint when O(bindings.add.protocol=https). |
| 66 |
- When using the Central Certificate Store feature, the certificate is automatically retrieved from the store rather than manually assigned to |
| 67 |
the binding. |
| 68 |
type: str |
| 69 |
certificate_store_name: |
| 70 |
description: |
| 71 |
- Name of the certificate store where the certificate for the binding is located. |
| 72 |
type: str |
| 73 |
default: "my" |
| 74 |
remove: |
| 75 |
description: |
| 76 |
- Specifies a list of bindings to remove from the website. |
| 77 |
type: list |
| 78 |
elements: dict |
| 79 |
suboptions: |
| 80 |
hostname: |
| 81 |
description: The website binding hostname (DNS). |
| 82 |
type: str |
| 83 |
ip: |
| 84 |
description: The website binding listen IP. |
| 85 |
type: str |
| 86 |
port: |
| 87 |
description: The website binding listen port. |
| 88 |
type: int |
| 89 |
set: |
| 90 |
description: |
| 91 |
- Specifies the exact list of bindings to set to the website. |
| 92 |
- This will remove any existing bindings if not in the specified list. |
| 93 |
- This will add any bindings in the specified list if it does not exist on the website. |
| 94 |
- Set to an empty list to clear all the website bindings. |
| 95 |
type: list |
| 96 |
elements: dict |
| 97 |
suboptions: |
| 98 |
hostname: |
| 99 |
description: |
| 100 |
- The website binding hostname (DNS). |
| 101 |
- Mandatory if O(bindings.set.use_sni=true) or O(bindings.set.use_ccs=true). |
| 102 |
type: str |
| 103 |
ip: |
| 104 |
description: The website binding listen IP. |
| 105 |
type: str |
| 106 |
port: |
| 107 |
description: The website binding listen port. |
| 108 |
type: int |
| 109 |
protocol: |
| 110 |
description: The website used protocol (http, https). |
| 111 |
type: str |
| 112 |
default: http |
| 113 |
choices: ["http", "https"] |
| 114 |
use_sni: |
| 115 |
description: |
| 116 |
- Require Server Name Indication (SNI) for SSL certificates. |
| 117 |
- Can be used only if O(bindings.set.protocol=https). |
| 118 |
- When O(bindings.set.use_sni=true), the O(bindings.set.hostname) value must be set. |
| 119 |
type: bool |
| 120 |
use_ccs: |
| 121 |
description: |
| 122 |
- Use Centralized Certificate Store (CCS) for SSL certificates. |
| 123 |
- Can be used only if O(bindings.set.protocol=https). |
| 124 |
- When O(bindings.set.use_ccs=true), the O(bindings.set.hostname) value must be set. |
| 125 |
- If V(true), O(bindings.set.certificate_hash) should not be used. |
| 126 |
type: bool |
| 127 |
certificate_hash: |
| 128 |
description: |
| 129 |
- Certificate hash (thumbprint) for the SSL binding. The certificate hash is the unique identifier for the certificate. |
| 130 |
- You can only provide a certificate thumbprint when O(bindings.set.protocol=https). |
| 131 |
- When using the Central Certificate Store feature, the certificate is automatically retrieved from the store rather than manually assigned to |
| 132 |
the binding. |
| 133 |
type: str |
| 134 |
certificate_store_name: |
| 135 |
description: |
| 136 |
- Name of the certificate store where the certificate for the binding is located. |
| 137 |
- When using the Central Certificate Store feature, the certificate is automatically retrieved from the store rather than manually assigned to. |
| 138 |
type: str |
| 139 |
default: "my" |
| 140 |
name: |
| 141 |
description: |
| 142 |
- The name of the website to manage. |
| 143 |
required: true |
| 144 |
type: str |
| 145 |
physical_path: |
| 146 |
description: |
| 147 |
- Specifies the physical folder path on the remote host to use for the website. |
| 148 |
- When create a new website physical_path is required. |
| 149 |
- The specified folder must already exist. |
| 150 |
type: str |
| 151 |
site_id: |
| 152 |
description: |
| 153 |
- Explicitly set the IIS website numeric ID. |
| 154 |
- Note that this value cannot be changed after the website has been created. |
| 155 |
- The site ID must be available and not used by any other website on the server. |
| 156 |
required: false |
| 157 |
type: str |
| 158 |
state: |
| 159 |
description: |
| 160 |
- State of the website. |
| 161 |
- In order to start the website at least one binding should be configured. |
| 162 |
type: str |
| 163 |
default: started |
| 164 |
choices: [absent, started, stopped, restarted] |
| 165 |
extends_documentation_fragment: |
| 166 |
- ansible.builtin.action_common_attributes |
| 167 |
attributes: |
| 168 |
check_mode: |
| 169 |
support: full |
| 170 |
diff_mode: |
| 171 |
support: none |
| 172 |
platform: |
| 173 |
platforms: |
| 174 |
- windows |
| 175 |
seealso: |
| 176 |
- module: microsoft.iis.website_info |
| 177 |
- module: microsoft.iis.web_app_pool |
| 178 |
author: |
| 179 |
- Shahar Golshani (@sgolshan) |
| 180 |
|
| 181 |
EXAMPLES: | |
| 182 |
- name: Create a default website in 'Started' state |
| 183 |
microsoft.iis.website: |
| 184 |
name: WebSite |
| 185 |
physical_path: C:\inetpub\wwwroot |
| 186 |
state: started |
| 187 |
bindings: |
| 188 |
set: |
| 189 |
- ip: 127.0.0.1 |
| 190 |
port: 80 |
| 191 |
hostname: my-website.com |
| 192 |
|
| 193 |
- name: Create a website with two bindings, set all values and start it |
| 194 |
microsoft.iis.website: |
| 195 |
name: WebSite |
| 196 |
site_id: 2 |
| 197 |
state: started |
| 198 |
physical_path: C:\wwwroot\websites\my-website |
| 199 |
application_pool: DefaultAppPool |
| 200 |
bindings: |
| 201 |
set: |
| 202 |
- ip: 127.0.0.1 |
| 203 |
port: 8081 |
| 204 |
hostname: my-website.com |
| 205 |
- ip: 127.0.0.2 |
| 206 |
port: 8082 |
| 207 |
hostname: my-website.net |
| 208 |
protocol: https |
| 209 |
use_sni: true |
| 210 |
use_ccs: false |
| 211 |
certificate_hash: 5409124040FA1C8FA74939BDA2EF8FD5975BD25B |
| 212 |
certificate_store_name: MY |
| 213 |
|
| 214 |
- name: Remove all the bindings from an existing website |
| 215 |
microsoft.iis.website: |
| 216 |
name: WebSite |
| 217 |
bindings: |
| 218 |
set: [] |
| 219 |
|
| 220 |
- name: Remove a specific binding from an existing website |
| 221 |
microsoft.iis.website: |
| 222 |
name: WebSite |
| 223 |
bindings: |
| 224 |
remove: |
| 225 |
- ip: 127.0.0.1 |
| 226 |
port: 8081 |
| 227 |
hostname: my-website.com |
| 228 |
|
| 229 |
- name: Add bindings to an existing website |
| 230 |
microsoft.iis.website: |
| 231 |
name: WebSite |
| 232 |
bindings: |
| 233 |
add: |
| 234 |
- ip: 127.0.0.3 |
| 235 |
port: 8083 |
| 236 |
hostname: new-website.com |
| 237 |
- ip: 127.0.0.4 |
| 238 |
port: 8084 |
| 239 |
hostname: new-website.net |
| 240 |
|
| 241 |
- name: Stop a website |
| 242 |
microsoft.iis.website: |
| 243 |
name: WebSite |
| 244 |
state: stopped |
| 245 |
|
| 246 |
- name: Restart a website (non-idempotent) |
| 247 |
microsoft.iis.website: |
| 248 |
name: WebSite |
| 249 |
state: restarted |
| 250 |
|
| 251 |
- name: Change a website application pool |
| 252 |
microsoft.iis.website: |
| 253 |
name: WebSite |
| 254 |
application_pool: NewAppPool |
| 255 |
|
| 256 |
- name: Change a website physical path |
| 257 |
microsoft.iis.website: |
| 258 |
name: WebSite |
| 259 |
physical_path: C:\wwwroot\websites\my-website |
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
RETURN: ~ |