win_iis_website - Configures a IIS Web site.

New in version 2.0.

Synopsis

  • Creates, Removes and configures a IIS Web site

Options

parameter required default choices comments
application_pool
no
The application pool in which the new site executes.
hostname
no
The host header to bind to / use for the new site.
ip
no
The IP address to bind to / use for the new site.
name
yes
Names of web site
parameters
no
Custom site Parameters from string where properties are separated by a pipe and property name/values by colon Ex. "foo:1|bar:2"
physical_path
no
The physical path on the remote host to use for the new site. The specified folder must already exist.
port
no
The port to bind to / use for the new site.
site_id
(added in 2.1)
no
Explicitly set the IIS numeric ID for a site. Note that this value cannot be changed after the website has been created.
ssl
no
Enables HTTPS binding on the site..
state
no
  • started
  • restarted
  • stopped
  • absent
State of the web site

Examples

# Start a website

- name: Acme IIS site
  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
  win_iis_website:
    name: "Default Web Site"
    state: absent

# Some commandline examples:

# This return information about an existing host
# $ ansible -i vagrant-inventory -m 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 win_iis_website -a "name='Default Web Site' state=stopped" host

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

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

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/win_iis_website_module.html