Microsoft IIS site management via WebAdministration powershell module
| maintainer: | Shane Lee <slee@saltstack.com>, Robert Booth <rbooth@saltstack.com> |
|---|---|
| platform: | Windows |
| depends: | PowerShell |
| depends: | WebAdministration module (PowerShell) (IIS) |
New in version 2016.3.0.
salt.modules.win_iis.create_app(name, site, sourcepath, apppool=None)¶Create an IIS application.
Note
This function only validates against the application name, and will return True even if the application already exists with a different configuration. It will not modify the configuration of an existing application.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.create_app name='app0' site='site0' sourcepath='C:\site0' apppool='site0'
salt.modules.win_iis.create_apppool(name)¶Create an IIS application pool.
Note
This function only validates against the application pool name, and will return True even if the application pool already exists with a different configuration. It will not modify the configuration of an existing application pool.
| Parameters: | name (str) – The name of the IIS application pool. |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.create_apppool name='MyTestPool'
salt.modules.win_iis.create_backup(name)¶Backup an IIS Configuration on the System.
New in version 2017.7.0.
Note
Backups are stored in the $env:Windir\System32\inetsrv\backup
folder.
| Parameters: | name (str) – The name to give the backup |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.create_backup good_config_20170209
salt.modules.win_iis.create_binding(site, hostheader=u'', ipaddress=u'*', port=80, protocol=u'http', sslflags=None)¶Create an IIS Web Binding.
Note
This function only validates against the binding ipaddress:port:hostheader combination, and will return True even if the binding already exists with a different configuration. It will not modify the configuration of an existing binding.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.create_binding site='site0' hostheader='example.com' ipaddress='*' port='80'
salt.modules.win_iis.create_cert_binding(name, site, hostheader=u'', ipaddress=u'*', port=443, sslflags=0)¶Assign a certificate to an IIS Web Binding.
New in version 2016.11.0.
Note
The web binding that the certificate is being assigned to must already exist.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.create_cert_binding name='AAA000' site='site0' hostheader='example.com' ipaddress='*' port='443'
salt.modules.win_iis.create_site(name, sourcepath, apppool=u'', hostheader=u'', ipaddress=u'*', port=80, protocol=u'http')¶Create a basic website in IIS.
Note
This function only validates against the site name, and will return True even if the site already exists with a different configuration. It will not modify the configuration of an existing site.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False. |
| Return type: | bool |
Note
If an application pool is specified, and that application pool does not already exist, it will be created.
CLI Example:
salt '*' win_iis.create_site name='My Test Site' sourcepath='c:\stage' apppool='TestPool'
salt.modules.win_iis.create_vdir(name, site, sourcepath, app=u'/')¶Create an IIS virtual directory.
Note
This function only validates against the virtual directory name, and will return True even if the virtual directory already exists with a different configuration. It will not modify the configuration of an existing virtual directory.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.create_vdir name='vd0' site='site0' sourcepath='C:\inetpub\vdirs\vd0'
salt.modules.win_iis.get_container_setting(name, container, settings)¶Get the value of the setting for the IIS container.
New in version 2016.11.0.
| Parameters: |
|
|---|---|
| Returns: | A dictionary of the provided settings and their values. |
| Return type: | dict |
CLI Example:
salt '*' win_iis.get_container_setting name='MyTestPool' container='AppPools'
settings="['processModel.identityType']"
salt.modules.win_iis.get_webapp_settings(name, site, settings)¶Get the value of the setting for the IIS web application. .. note:
Params are case sensitive.
| Parameters: |
|
|---|---|
| Returns: | A dictionary of the provided settings and their values. |
| Return type: | dict |
New in version 2017.7.0.
CLI Example: .. code-block:: bash
- salt ‘*’ win_iis.get_webapp_settings name=’app0’ site=’Default Web Site’
- settings=”[‘physicalPath’,’applicationPool’]”
salt.modules.win_iis.list_apppools()¶List all configured IIS application pools.
| Returns: | A dictionary of IIS application pools and their details. |
|---|---|
| Return type: | dict |
CLI Example:
salt '*' win_iis.list_apppools
salt.modules.win_iis.list_apps(site)¶Get all configured IIS applications for the specified site.
| Parameters: | site (str) – The IIS site name. |
|---|
Returns: A dictionary of the application names and properties.
CLI Example:
salt '*' win_iis.list_apps site
salt.modules.win_iis.list_backups()¶List the IIS Configuration Backups on the System.
New in version 2017.7.0.
Note
Backups are made when a configuration is edited. Manual backups are
stored in the $env:Windir\System32\inetsrv\backup folder.
| Returns: | A dictionary of IIS Configurations backed up on the system. |
|---|---|
| Return type: | dict |
CLI Example:
salt '*' win_iis.list_backups
salt.modules.win_iis.list_bindings(site)¶Get all configured IIS bindings for the specified site.
| Parameters: | site (str) – The name if the IIS Site |
|---|---|
| Returns: | A dictionary of the binding names and properties. |
| Return type: | dict |
CLI Example:
salt '*' win_iis.list_bindings site
salt.modules.win_iis.list_cert_bindings(site)¶List certificate bindings for an IIS site.
New in version 2016.11.0.
| Parameters: | site (str) – The IIS site name. |
|---|---|
| Returns: | A dictionary of the binding names and properties. |
| Return type: | dict |
CLI Example:
salt '*' win_iis.list_bindings site
salt.modules.win_iis.list_sites()¶List all the currently deployed websites.
| Returns: | A dictionary of the IIS sites and their properties. |
|---|---|
| Return type: | dict |
CLI Example:
salt '*' win_iis.list_sites
salt.modules.win_iis.list_vdirs(site, app=u'/')¶Get all configured IIS virtual directories for the specified site, or for the combination of site and application.
| Parameters: |
|
|---|---|
| Returns: | A dictionary of the virtual directory names and properties. |
| Return type: | dict |
CLI Example:
salt '*' win_iis.list_vdirs site
salt.modules.win_iis.list_worker_processes(apppool)¶Returns a list of worker processes that correspond to the passed application pool.
New in version 2017.7.0.
| Parameters: | apppool (str) – The application pool to query |
|---|---|
| Returns: | A dictionary of worker processes with their process IDs |
| Return type: | dict |
CLI Example:
salt '*' win_iis.list_worker_processes 'My App Pool'
salt.modules.win_iis.modify_binding(site, binding, hostheader=None, ipaddress=None, port=None, sslflags=None)¶Modify an IIS Web Binding. Use site and binding to target the
binding.
New in version 2017.7.0.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
The following will seat the host header of binding *:80: for site0
to example.com
salt '*' win_iis.modify_binding site='site0' binding='*:80:' hostheader='example.com'
salt.modules.win_iis.modify_site(name, sourcepath=None, apppool=None)¶Modify a basic website in IIS.
New in version 2017.7.0.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False. |
| Return type: | bool |
Note
If an application pool is specified, and that application pool does not already exist, it will be created.
CLI Example:
salt '*' win_iis.modify_site name='My Test Site' sourcepath='c:\new_path' apppool='NewTestPool'
salt.modules.win_iis.remove_app(name, site)¶Remove an IIS application.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.remove_app name='app0' site='site0'
salt.modules.win_iis.remove_apppool(name)¶Remove an IIS application pool.
| Parameters: | name (str) – The name of the IIS application pool. |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.remove_apppool name='MyTestPool'
salt.modules.win_iis.remove_backup(name)¶Remove an IIS Configuration backup from the System.
New in version 2017.7.0.
| Parameters: | name (str) – The name of the backup to remove |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.remove_backup backup_20170209
salt.modules.win_iis.remove_binding(site, hostheader=u'', ipaddress=u'*', port=80)¶Remove an IIS binding.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.remove_binding site='site0' hostheader='example.com' ipaddress='*' port='80'
salt.modules.win_iis.remove_cert_binding(name, site, hostheader=u'', ipaddress=u'*', port=443)¶Remove a certificate from an IIS Web Binding.
New in version 2016.11.0.
Note
This function only removes the certificate from the web binding. It does not remove the web binding itself.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.remove_cert_binding name='AAA000' site='site0' hostheader='example.com' ipaddress='*' port='443'
salt.modules.win_iis.remove_site(name)¶Delete a website from IIS.
| Parameters: | name (str) – The IIS site name. |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
Note
This will not remove the application pool used by the site.
CLI Example:
salt '*' win_iis.remove_site name='My Test Site'
salt.modules.win_iis.remove_vdir(name, site, app=u'/')¶Remove an IIS virtual directory.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.remove_vdir name='vdir0' site='site0'
salt.modules.win_iis.restart_apppool(name)¶Restart an IIS application pool.
New in version 2016.11.0.
| Parameters: | name (str) – The name of the IIS application pool. |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.restart_apppool name='MyTestPool'
salt.modules.win_iis.restart_site(name)¶Restart a Web Site in IIS.
New in version 2017.7.0.
| Parameters: | name (str) – The name of the website to restart. |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.restart_site name='My Test Site'
salt.modules.win_iis.set_container_setting(name, container, settings)¶Set the value of the setting for an IIS container.
New in version 2016.11.0.
| Parameters: |
|
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.set_container_setting name='MyTestPool' container='AppPools'
settings="{'managedPipeLineMode': 'Integrated'}"
salt.modules.win_iis.set_webapp_settings(name, site, settings)¶Configure an IIS application. .. note:
This function only configures existing app.
Params are case sensitive.
| Parameters: |
|
|---|---|
| Available settings: | |
physicalPath: The physical path of the webapp. |
|
: applicationPool: The application pool for the webapp. : userName: “connectAs” user : password: “connectAs” password for user :return: A boolean representing whether all changes succeeded. :rtype: bool .. versionadded:: 2017.7.0 CLI Example: .. code-block:: bash
salt ‘*’ win_iis.set_webapp_settings name=’app0’ site=’site0’ settings=”{‘physicalPath’: ‘C:site0’, ‘apppool’: ‘site0’}”
salt.modules.win_iis.start_apppool(name)¶Start an IIS application pool.
New in version 2017.7.0.
| Parameters: | name (str) – The name of the App Pool to start. |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.start_apppool name='MyTestPool'
salt.modules.win_iis.start_site(name)¶Start a Web Site in IIS.
New in version 2017.7.0.
| Parameters: | name (str) – The name of the website to start. |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.start_site name='My Test Site'
salt.modules.win_iis.stop_apppool(name)¶Stop an IIS application pool.
New in version 2017.7.0.
| Parameters: | name (str) – The name of the App Pool to stop. |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.stop_apppool name='MyTestPool'
salt.modules.win_iis.stop_site(name)¶Stop a Web Site in IIS.
New in version 2017.7.0.
| Parameters: | name (str) – The name of the website to stop. |
|---|---|
| Returns: | True if successful, otherwise False |
| Return type: | bool |
CLI Example:
salt '*' win_iis.stop_site name='My Test Site'