salt.states.win_iis module

Microsoft IIS site management

This module provides the ability to add/remove websites and application pools from Microsoft IIS.

New in version 2016.3.0.

salt.states.win_iis.container_setting(name, container, settings=None)

Set the value of the setting for an IIS container.

Parameters:
  • name (str) -- The name of the IIS container.
  • container (str) -- The type of IIS container. The container types are: AppPools, Sites, SslBindings
  • settings (str) -- A dictionary of the setting names and their values. Example of usage for the AppPools container:
site0-apppool-setting:
    win_iis.container_setting:
        - name: site0
        - container: AppPools
        - settings:
            managedPipelineMode: Integrated
            processModel.maxProcesses: 1
            processModel.userName: TestUser
            processModel.password: TestPassword
            processModel.identityType: SpecificUser

Example of usage for the Sites container:

site0-site-setting:
    win_iis.container_setting:
        - name: site0
        - container: Sites
        - settings:
            logFile.logFormat: W3C
            logFile.period: Daily
            limits.maxUrlSegments: 32
salt.states.win_iis.create_app(name, site, sourcepath, apppool=None)

Create an IIS application.

Parameters:
  • name (str) -- The IIS application.
  • site (str) -- The IIS site name.
  • sourcepath (str) -- The physical path.
  • apppool (str) -- The name of the IIS application pool.

Example of usage with only the required arguments:

site0-v1-app:
    win_iis.create_app:
        - name: v1
        - site: site0
        - sourcepath: C:\inetpub\site0\v1

Example of usage specifying all available arguments:

site0-v1-app:
    win_iis.create_app:
        - name: v1
        - site: site0
        - sourcepath: C:\inetpub\site0\v1
        - apppool: site0
salt.states.win_iis.create_apppool(name)

Create an IIS application pool.

Parameters:name (str) -- The name of the IIS application pool.

Usage:

site0-apppool:
    win_iis.create_apppool:
        - name: site0
salt.states.win_iis.create_binding(name, site, hostheader='', ipaddress='*', port=80, protocol='http', sslflags=0)

Create an IIS binding.

Parameters:
  • site (str) -- The IIS site name.
  • hostheader (str) -- The host header of the binding.
  • ipaddress (str) -- The IP address of the binding.
  • port (str) -- The TCP port of the binding.
  • protocol (str) -- The application protocol of the binding.
  • sslflags (str) -- The flags representing certificate type and storage of the binding.

Example of usage with only the required arguments:

site0-https-binding:
    win_iis.create_binding:
        - site: site0

Example of usage specifying all available arguments:

site0-https-binding:
    win_iis.create_binding:
        - site: site0
        - hostheader: site0.local
        - ipaddress: '*'
        - port: 443
        - protocol: https
        - sslflags: 0
salt.states.win_iis.create_cert_binding(name, site, hostheader='', ipaddress='*', port=443, sslflags=0)

Assign a certificate to an IIS binding.

Parameters:
  • name (str) -- The thumbprint of the certificate.
  • site (str) -- The IIS site name.
  • hostheader (str) -- The host header of the binding.
  • ipaddress (str) -- The IP address of the binding.
  • port (str) -- The TCP port of the binding.
  • sslflags (str) -- Flags representing certificate type and certificate storage of the binding.

Example of usage with only the required arguments:

site0-cert-binding:
    win_iis.create_cert_binding:
        - name: 9988776655443322111000AAABBBCCCDDDEEEFFF
        - site: site0

Example of usage specifying all available arguments:

site0-cert-binding:
    win_iis.create_cert_binding:
        - name: 9988776655443322111000AAABBBCCCDDDEEEFFF
        - site: site0
        - hostheader: site0.local
        - ipaddress: 192.168.1.199
        - port: 443
        - sslflags: 1

New in version 2016.11.0.

salt.states.win_iis.create_vdir(name, site, sourcepath, app='/')

Create an IIS virtual directory.

Parameters:
  • name (str) -- The virtual directory name.
  • site (str) -- The IIS site name.
  • sourcepath (str) -- The physical path.
  • app (str) -- The IIS application.

Example of usage with only the required arguments:

site0-foo-vdir:
    win_iis.create_vdir:
        - name: foo
        - site: site0
        - sourcepath: C:\inetpub\vdirs\foo

Example of usage specifying all available arguments:

site0-foo-vdir:
    win_iis.create_vdir:
        - name: foo
        - site: site0
        - sourcepath: C:\inetpub\vdirs\foo
        - app: v1
salt.states.win_iis.deployed(name, sourcepath, apppool='', hostheader='', ipaddress='*', port=80, protocol='http')

Ensure the website has been deployed.

Parameters:
  • name (str) -- The IIS site name.
  • sourcepath (str) -- The physical path of the IIS site.
  • apppool (str) -- The name of the IIS application pool.
  • hostheader (str) -- The host header of the binding.
  • ipaddress (str) -- The IP address of the binding.
  • port (str) -- The TCP port of the binding.
  • protocol (str) -- The application protocol of the binding.

Example of usage with only the required arguments. This will default to using the default application pool assigned by IIS:

site0-deployed:
    win_iis.deployed:
        - name: site0
        - sourcepath: C:\inetpub\site0

Example of usage specifying all available arguments:

site0-deployed:
    win_iis.deployed:
        - name: site0
        - sourcepath: C:\inetpub\site0
        - apppool: site0
        - hostheader: site0.local
        - ipaddress: '*'
        - port: 443
        - protocol: https
salt.states.win_iis.remove_app(name, site)

Remove an IIS application.

Parameters:
  • name (str) -- The application name.
  • site (str) -- The IIS site name.

Usage:

site0-v1-app-remove:
    win_iis.remove_app:
        - name: v1
        - site: site0
salt.states.win_iis.remove_apppool(name)

Remove an IIS application pool.

Parameters:name (str) -- The name of the IIS application pool.

Usage:

defaultapppool-remove:
    win_iis.remove_apppool:
        - name: DefaultAppPool
salt.states.win_iis.remove_binding(name, site, hostheader='', ipaddress='*', port=80)

Remove an IIS binding.

Parameters:
  • site (str) -- The IIS site name.
  • hostheader (str) -- The host header of the binding.
  • ipaddress (str) -- The IP address of the binding.
  • port (str) -- The TCP port of the binding.

Example of usage with only the required arguments:

site0-https-binding-remove:
    win_iis.remove_binding:
        - site: site0

Example of usage specifying all available arguments:

site0-https-binding-remove:
    win_iis.remove_binding:
        - site: site0
        - hostheader: site0.local
        - ipaddress: '*'
        - port: 443
salt.states.win_iis.remove_cert_binding(name, site, hostheader='', ipaddress='*', port=443)

Remove a certificate from an IIS binding.

Parameters:
  • name (str) -- The thumbprint of the certificate.
  • site (str) -- The IIS site name.
  • hostheader (str) -- The host header of the binding.
  • ipaddress (str) -- The IP address of the binding.
  • port (str) -- The TCP port of the binding.

Example of usage with only the required arguments:

site0-cert-binding-remove:
    win_iis.remove_cert_binding:
        - name: 9988776655443322111000AAABBBCCCDDDEEEFFF
        - site: site0

Example of usage specifying all available arguments:

site0-cert-binding-remove:
    win_iis.remove_cert_binding:
        - name: 9988776655443322111000AAABBBCCCDDDEEEFFF
        - site: site0
        - hostheader: site0.local
        - ipaddress: 192.168.1.199
        - port: 443

New in version 2016.11.0.

salt.states.win_iis.remove_site(name)

Delete a website from IIS.

Parameters:name (str) -- The IIS site name.

Usage:

defaultwebsite-remove:
    win_iis.remove_site:
        - name: Default Web Site
salt.states.win_iis.remove_vdir(name, site, app='/')

Remove an IIS virtual directory.

Parameters:
  • name (str) -- The virtual directory name.
  • site (str) -- The IIS site name.
  • app (str) -- The IIS application.

Example of usage with only the required arguments:

site0-foo-vdir-remove:
    win_iis.remove_vdir:
        - name: foo
        - site: site0

Example of usage specifying all available arguments:

site0-foo-vdir-remove:
    win_iis.remove_vdir:
        - name: foo
        - site: site0
        - app: v1
salt.states.win_iis.set_app(name, site, settings=None)

New in version 2017.7.0.

Set the value of the setting for an IIS web application.

Note

This function only configures 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.

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 type:bool

Example of usage:

site0-webapp-setting:
    win_iis.set_app:
        - name: app0
        - site: Default Web Site
        - settings:
            userName: domain\user
            password: pass
            physicalPath: c:\inetpub\wwwroot
            applicationPool: appPool0