| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
|
| 4 |
# Copyright: (c) 2015, Henrik Wallström <[email protected]> |
| 5 |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
DOCUMENTATION = r''' |
| 8 |
--- |
| 9 |
module: win_iis_website |
| 10 |
short_description: Configures a IIS Web site |
| 11 |
description: |
| 12 |
- Creates, Removes and configures a IIS Web site. |
| 13 |
deprecated: |
| 14 |
removed_in: 4.0.0 |
| 15 |
why: >- |
| 16 |
This module has been deprecated and an alternative supported module is available in the C(microsoft.iis) collection. |
| 17 |
alternative: Use C(microsoft.iis.website) instead. |
| 18 |
options: |
| 19 |
name: |
| 20 |
description: |
| 21 |
- Names of web site. |
| 22 |
type: str |
| 23 |
required: yes |
| 24 |
site_id: |
| 25 |
description: |
| 26 |
- Explicitly set the IIS numeric ID for a site. |
| 27 |
- Note that this value cannot be changed after the website has been created. |
| 28 |
type: str |
| 29 |
state: |
| 30 |
description: |
| 31 |
- State of the web site |
| 32 |
type: str |
| 33 |
choices: [ absent, started, stopped, restarted ] |
| 34 |
physical_path: |
| 35 |
description: |
| 36 |
- The physical path on the remote host to use for the new site. |
| 37 |
- The specified folder must already exist. |
| 38 |
type: str |
| 39 |
application_pool: |
| 40 |
description: |
| 41 |
- The application pool in which the new site executes. |
| 42 |
type: str |
| 43 |
port: |
| 44 |
description: |
| 45 |
- The port to bind to / use for the new site. |
| 46 |
type: int |
| 47 |
ip: |
| 48 |
description: |
| 49 |
- The IP address to bind to / use for the new site. |
| 50 |
type: str |
| 51 |
hostname: |
| 52 |
description: |
| 53 |
- The host header to bind to / use for the new site. |
| 54 |
type: str |
| 55 |
parameters: |
| 56 |
description: |
| 57 |
- Custom site Parameters from string where properties are separated by a pipe and property name/values by colon Ex. "foo:1|bar:2" |
| 58 |
- Some custom parameters that you can use are listed below, this isn't a definitive list but some common parameters. |
| 59 |
- C(logfile.directory) - Physical path to store Logs, e.g. C(D:\IIS-LOGs\). |
| 60 |
- C(logfile.period) - Log file rollover scheduled accepting these values, how frequently the log file should be rolled-over, |
| 61 |
e.g. C(Hourly, Daily, Weekly, Monthly). |
| 62 |
- C(logfile.LogFormat) - Log file format, by default IIS uses C(W3C). |
| 63 |
- C(logfile.truncateSize) - The size at which the log file contents will be trunsted, expressed in bytes. |
| 64 |
type: str |
| 65 |
seealso: |
| 66 |
- module: community.windows.win_iis_virtualdirectory |
| 67 |
- module: community.windows.win_iis_webapplication |
| 68 |
- module: community.windows.win_iis_webapppool |
| 69 |
- module: community.windows.win_iis_webbinding |
| 70 |
author: |
| 71 |
- Henrik Wallström (@henrikwallstrom) |
| 72 |
''' |
| 73 |
|
| 74 |
EXAMPLES = r''' |
| 75 |
|
| 76 |
# Start a website |
| 77 |
|
| 78 |
- name: Acme IIS site |
| 79 |
community.windows.win_iis_website: |
| 80 |
name: Acme |
| 81 |
state: started |
| 82 |
port: 80 |
| 83 |
ip: 127.0.0.1 |
| 84 |
hostname: acme.local |
| 85 |
application_pool: acme |
| 86 |
physical_path: C:\sites\acme |
| 87 |
parameters: logfile.directory:C:\sites\logs |
| 88 |
register: website |
| 89 |
|
| 90 |
# Remove Default Web Site and the standard port 80 binding |
| 91 |
- name: Remove Default Web Site |
| 92 |
community.windows.win_iis_website: |
| 93 |
name: "Default Web Site" |
| 94 |
state: absent |
| 95 |
|
| 96 |
# Create a WebSite with custom Logging configuration (Logs Location, Format and Rolling Over). |
| 97 |
|
| 98 |
- name: Creating WebSite with Custom Log location, Format 3WC and rolling over every hour. |
| 99 |
community.windows.win_iis_website: |
| 100 |
name: MyCustom_Web_Shop_Site |
| 101 |
state: started |
| 102 |
port: 80 |
| 103 |
ip: '*' |
| 104 |
hostname: '*' |
| 105 |
physical_path: D:\wwwroot\websites\my-shop-site |
| 106 |
parameters: logfile.directory:D:\IIS-LOGS\websites\my-shop-site|logfile.period:Hourly|logFile.logFormat:W3C |
| 107 |
application_pool: my-shop-site |
| 108 |
|
| 109 |
# Some commandline examples: |
| 110 |
|
| 111 |
# This return information about an existing host |
| 112 |
# $ ansible -i vagrant-inventory -m community.windows.win_iis_website -a "name='Default Web Site'" window |
| 113 |
# host | success >> { |
| 114 |
# "changed": false, |
| 115 |
# "site": { |
| 116 |
# "ApplicationPool": "DefaultAppPool", |
| 117 |
# "Bindings": [ |
| 118 |
# "*:80:" |
| 119 |
# ], |
| 120 |
# "ID": 1, |
| 121 |
# "Name": "Default Web Site", |
| 122 |
# "PhysicalPath": "%SystemDrive%\\inetpub\\wwwroot", |
| 123 |
# "State": "Stopped" |
| 124 |
# } |
| 125 |
# } |
| 126 |
|
| 127 |
# This stops an existing site. |
| 128 |
# $ ansible -i hosts -m community.windows.win_iis_website -a "name='Default Web Site' state=stopped" host |
| 129 |
|
| 130 |
# This creates a new site. |
| 131 |
# $ ansible -i hosts -m community.windows.win_iis_website -a "name=acme physical_path=C:\\sites\\acme" host |
| 132 |
|
| 133 |
# Change logfile. |
| 134 |
# $ ansible -i hosts -m community.windows.win_iis_website -a "name=acme physical_path=C:\\sites\\acme" host |
| 135 |
''' |