Skip to content

Latest commit

 

History

History
279 lines (240 loc) · 10.2 KB

community.windows.win_iis_website_module.rst

File metadata and controls

279 lines (240 loc) · 10.2 KB

community.windows.win_iis_website

Configures a IIS Web site

  • Creates, Removes and configures a IIS Web site.
Parameter Choices/Defaults Comments
application_pool
string
The application pool in which the new site executes.
hostname
string
The host header to bind to / use for the new site.
ip
string
The IP address to bind to / use for the new site.
name
string / required
Names of web site.
parameters
string
Custom site Parameters from string where properties are separated by a pipe and property name/values by colon Ex. "foo:1|bar:2"
Some custom parameters that you can use are listed below, this isn't a definitive list but some common parameters.
logfile.directory - Physical path to store Logs, e.g. D:\IIS-LOGs\.
logfile.period - Log file rollover scheduled accepting these values, how frequently the log file should be rolled-over, e.g. Hourly, Daily, Weekly, Monthly.
logfile.LogFormat - Log file format, by default IIS uses W3C.
logfile.truncateSize - The size at which the log file contents will be trunsted, expressed in bytes.
physical_path
string
The physical path on the remote host to use for the new site.
The specified folder must already exist.
port
integer
The port to bind to / use for the new site.
site_id
string
Explicitly set the IIS numeric ID for a site.
Note that this value cannot be changed after the website has been created.
state
string
    Choices:
  • absent
  • started
  • stopped
  • restarted
State of the web site

.. seealso::

   :ref:`community.windows.win_iis_virtualdirectory_module`
      The official documentation on the **community.windows.win_iis_virtualdirectory** module.
   :ref:`community.windows.win_iis_webapplication_module`
      The official documentation on the **community.windows.win_iis_webapplication** module.
   :ref:`community.windows.win_iis_webapppool_module`
      The official documentation on the **community.windows.win_iis_webapppool** module.
   :ref:`community.windows.win_iis_webbinding_module`
      The official documentation on the **community.windows.win_iis_webbinding** module.


# Start a website

- name: Acme IIS site
  community.windows.win_iis_website:
    name: Acme
    state: started
    port: 80
    ip: 127.0.0.1
    hostname: acme.local
    application_pool: acme
    physical_path: C:\sites\acme
    parameters: logfile.directory:C:\sites\logs
  register: website

# Remove Default Web Site and the standard port 80 binding
- name: Remove Default Web Site
  community.windows.win_iis_website:
    name: "Default Web Site"
    state: absent

# Create a WebSite with custom Logging configuration (Logs Location, Format and Rolling Over).

- name: Creating WebSite with Custom Log location, Format 3WC and rolling over every hour.
  community.windows.win_iis_website:
    name: MyCustom_Web_Shop_Site
    state: started
    port: 80
    ip: '*'
    hostname: '*'
    physical_path: D:\wwwroot\websites\my-shop-site
    parameters: logfile.directory:D:\IIS-LOGS\websites\my-shop-site|logfile.period:Hourly|logFile.logFormat:W3C
    application_pool: my-shop-site

# Some commandline examples:

# This return information about an existing host
# $ ansible -i vagrant-inventory -m community.windows.win_iis_website -a "name='Default Web Site'" window
# host | success >> {
#     "changed": false,
#     "site": {
#         "ApplicationPool": "DefaultAppPool",
#         "Bindings": [
#             "*:80:"
#         ],
#         "ID": 1,
#         "Name": "Default Web Site",
#         "PhysicalPath": "%SystemDrive%\\inetpub\\wwwroot",
#         "State": "Stopped"
#     }
# }

# This stops an existing site.
# $ ansible -i hosts -m community.windows.win_iis_website -a "name='Default Web Site' state=stopped" host

# This creates a new site.
# $ ansible -i hosts -m community.windows.win_iis_website -a "name=acme physical_path=C:\\sites\\acme" host

# Change logfile.
# $ ansible -i hosts -m community.windows.win_iis_website -a "name=acme physical_path=C:\\sites\\acme" host

Authors

  • Henrik Wallström (@henrikwallstrom)