salt.modules.win_iis#
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:
Trueif successful, otherwiseFalse.- Return type:
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:
Trueif successful, otherwiseFalse.- Return type:
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\backupfolder.- Parameters:
name (str) -- The name to give the backup
- Returns:
Trueif successful, otherwiseFalse.- Return type:
CLI Example:
salt '*' win_iis.create_backup good_config_20170209
- salt.modules.win_iis.create_binding(site, hostheader='', ipaddress='*', port=80, protocol='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:
site (str) -- The IIS site name.
hostheader (
str, optional) -- The host header of the binding. Usually a hostname. Default is ""ipaddress (
str, optional) -- The IP address of the binding. Default is "*"port (
int, optional) -- The TCP port of the binding. Default is 80protocol (
str, optional) -- The application protocol of the binding. Default is "httpsslflags (
str, optional) -- The flags representing certificate type and storage of the binding. Default isNone.
- Returns:
Trueif successful, otherwiseFalse.- Return type:
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='', ipaddress='*', 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:
name (str) -- The thumbprint of the certificate.
site (str) -- The IIS site name.
hostheader (
str, optional) -- The host header of the binding. Default is ""ipaddress (
str, optional) -- The IP address of the binding. Default is "*"port (
int, optional) -- The TCP port of the binding. Default is 443sslflags (
int, optional) -- Flags representing certificate type and certificate storage of the binding. Default is 0
- Returns:
Trueif successful, otherwiseFalse.- Return type:
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='', hostheader='', ipaddress='*', port=80, protocol='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:
name (str) -- The IIS site name.
sourcepath (str) -- The physical path of the IIS site.
apppool (
str, optional) -- The name of the IIS application pool. Default is ""hostheader (
str, optional) -- The host header of the binding. Usually the hostname or website name, ie: www.contoso.com Default is ""ipaddress (
str, optional) -- The IP address of the binding. Default is "*"port (
int, optional) -- The TCP port of the binding. Default is 80protocol (
str, optional) -- The application protocol of the binding. (http, https, etc.) Default is "http"
- Returns:
Trueif successful, otherwiseFalse.- Return type:
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='/')#
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:
Trueif successful, otherwiseFalse.- Return type:
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:
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)#
New in version 2017.7.0.
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:
CLI Example:
salt '*' win_iis.get_webapp_settings name='app0' site='Default Web Site' settings='["physicalPath","applicationPool"]'
- salt.modules.win_iis.get_webconfiguration_settings(name, settings)#
Get the webconfiguration settings for the IIS PSPath.
- Parameters:
- Returns:
A list of dictionaries containing setting name, filter and value.
- Return type:
CLI Example:
salt '*' win_iis.get_webconfiguration_settings name='IIS:\' settings='[{"name": "enabled", "filter": "system.webServer/security/authentication/anonymousAuthentication"}]'
- salt.modules.win_iis.list_apppools()#
List all configured IIS application pools.
- Returns:
A dictionary of IIS application pools and their details.
- Return type:
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\backupfolder.- Returns:
A dictionary of IIS Configurations backed up on the system.
- Return type:
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:
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:
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:
CLI Example:
salt '*' win_iis.list_sites
- salt.modules.win_iis.list_vdirs(site, app='/')#
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:
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:
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
siteandbindingto target the binding.New in version 2017.7.0.
- Parameters:
site (str) -- The IIS site name.
binding (str) -- The binding to edit. This is a combination of the IP address, port, and hostheader. It is in the following format: ipaddress:port:hostheader. For example,
*:80:or*:80:salt.comhostheader (
str, optional) -- The host header of the binding. Usually the hostname. Default isNone.ipaddress (
str, optional) -- The IP address of the binding. Default isNone.port (
int, optional) -- The TCP port of the binding. Default isNone.sslflags (
str, optional) -- The flags representing certificate type and storage of the binding. Default isNone.
- Returns:
Trueif successful, otherwiseFalse.- Return type:
CLI Example:
The following will seat the host header of binding
*:80:forsite0toexample.comsalt '*' 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:
Trueif successful, otherwiseFalse.- Return type:
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:
Trueif successful, otherwiseFalse.- Return type:
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:
Trueif successful, otherwiseFalse.- Return type:
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:
Trueif successful, otherwiseFalse.- Return type:
CLI Example:
salt '*' win_iis.remove_backup backup_20170209
- salt.modules.win_iis.remove_binding(site, hostheader='', ipaddress='*', port=80)#
Remove an IIS binding.
- Parameters:
- Returns:
Trueif successful, otherwiseFalse.- Return type:
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='', ipaddress='*', 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:
name (str) -- The thumbprint of the certificate.
site (str) -- The IIS site name.
hostheader (
str, optional) -- The host header of the binding. Default is ""ipaddress (
str, optional) -- The IP address of the binding. Default is "*"port (
int, optional) -- The TCP port of the binding. Default is 443
- Returns:
Trueif successful, otherwiseFalse.- Return type:
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:
Trueif successful, otherwiseFalse.- Return type:
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='/')#
Remove an IIS virtual directory.
- Parameters:
- Returns:
Trueif successful, otherwiseFalse.- Return type:
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:
Trueif successful, otherwiseFalse.- Return type:
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:
Trueif successful, otherwiseFalse.- Return type:
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:
Trueif successful, otherwiseFalse.- Return type:
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)#
New in version 2017.7.0.
Configure an IIS application.
Note
This function only configures an existing app. Params are case-sensitive.
- Parameters:
name (str) -- The IIS application.
site (str) -- The IIS site name.
settings (str) --
A dictionary of the setting names and their values.
physicalPath: The physical path of the webapp.
applicationPool: The application pool for the webapp.
userName: "connectAs" user
password: "connectAs" password for user
- Returns:
A boolean representing whether all changes succeeded.
- Return type:
CLI Example:
salt '*' win_iis.set_webapp_settings name='app0' site='site0' settings='{"physicalPath": "C:\site0", "apppool": "site0"}'
- salt.modules.win_iis.set_webconfiguration_settings(name, settings)#
Set the value of the setting for an IIS container.
- Parameters:
- Returns:
Trueif successful, otherwiseFalse.- Return type:
CLI Example:
salt '*' win_iis.set_webconfiguration_settings name='IIS:\' settings='[{"name": "enabled", "filter": "system.webServer/security/authentication/anonymousAuthentication", "value": False}]'
- 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:
Trueif successful, otherwiseFalse.- Return type:
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:
Trueif successful, otherwiseFalse.- Return type:
CLI Example:
salt '*' win_iis.start_site name='My Test Site'