community.windows.win_iis_webapppool module – Configure IIS Web Application Pools
Note
This module is part of the community.windows collection (version 2.4.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.windows.
To use it in a playbook, specify: community.windows.win_iis_webapppool.
Synopsis
- Creates, removes and configures an IIS Web Application Pool. 
Parameters
| Parameter | Comments | 
|---|---|
| This field is a free form dictionary value for the application pool attributes. These attributes are based on the naming standard at https://www.iis.net/configreference/system.applicationhost/applicationpools/add#005, see the examples section for more details on how to set this. You can also set the attributes of child elements like cpu and processModel, see the examples to see how it is done. While you can use the numeric values for enums it is recommended to use the enum name itself, e.g. use SpecificUser instead of 3 for processModel.identityType. managedPipelineMode may be either “Integrated” or “Classic”. startMode may be either “OnDemand” or “AlwaysRunning”. Use  When trying to set ‘processModel.password’ and you receive a ‘Value does fall within the expected range’ error, you have a corrupted keystore. Please follow http://structuredsight.com/2014/10/26/im-out-of-range-youre-out-of-range/ to help fix your host. | |
| Name of the application pool. | |
| The state of the application pool. If  If  If  If  If  Choices: 
 | 
See Also
See also
- community.windows.win_iis_virtualdirectory
- Configures a virtual directory in IIS. 
- community.windows.win_iis_webapplication
- Configures IIS web applications. 
- community.windows.win_iis_webbinding
- Configures a IIS Web site binding. 
- community.windows.win_iis_website
- Configures a IIS Web site. 
Examples
- name: Return information about an existing application pool
  community.windows.win_iis_webapppool:
    name: DefaultAppPool
    state: present
- name: Create a new application pool in 'Started' state
  community.windows.win_iis_webapppool:
    name: AppPool
    state: started
- name: Stop an application pool
  community.windows.win_iis_webapppool:
    name: AppPool
    state: stopped
- name: Restart an application pool (non-idempotent)
  community.windows.win_iis_webapppool:
    name: AppPool
    state: restarted
- name: Change application pool attributes using new dict style
  community.windows.win_iis_webapppool:
    name: AppPool
    attributes:
      managedRuntimeVersion: v4.0
      autoStart: false
- name: Creates an application pool, sets attributes and starts it
  community.windows.win_iis_webapppool:
    name: AnotherAppPool
    state: started
    attributes:
      managedRuntimeVersion: v4.0
      autoStart: false
- name: Creates an application pool with "No Managed Code" for .Net compatibility
  community.windows.win_iis_webapppool:
    name: AnotherAppPool
    state: started
    attributes:
      managedRuntimeVersion: ''
      autoStart: false
# In the below example we are setting attributes in child element processModel
# https://www.iis.net/configreference/system.applicationhost/applicationpools/add/processmodel
- name: Manage child element and set identity of application pool
  community.windows.win_iis_webapppool:
    name: IdentitiyAppPool
    state: started
    attributes:
      managedPipelineMode: Classic
      processModel.identityType: SpecificUser
      processModel.userName: '{{ansible_user}}'
      processModel.password: '{{ansible_password}}'
      processModel.loadUserProfile: true
- name: Manage a timespan attribute
  community.windows.win_iis_webapppool:
    name: TimespanAppPool
    state: started
    attributes:
      # Timespan with full string "day:hour:minute:second.millisecond"
      recycling.periodicRestart.time: "00:00:05:00.000000"
      recycling.periodicRestart.schedule: ["00:10:00", "05:30:00"]
      # Shortened timespan "hour:minute:second"
      processModel.pingResponseTime: "00:03:00"
Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Description | 
|---|---|
| Application Pool attributes that were set and processed by this module invocation. Returned: success Sample:  | |
| Information on current state of the Application Pool. See https://www.iis.net/configreference/system.applicationhost/applicationpools/add#005 for the full list of return attributes based on your IIS version. Returned: success | |
| Key value pairs showing the current Application Pool attributes. Returned: success Sample:  | |
| Key value pairs showing the current Application Pool cpu attributes. Returned: success Sample:  | |
| Key value pairs showing the current Application Pool failure attributes. Returned: success Sample:  | |
| Name of Application Pool that was processed by this module invocation. Returned: success Sample:  | |
| Key value pairs showing the current Application Pool processModel attributes. Returned: success Sample:  | |
| Key value pairs showing the current Application Pool recycling attributes. Returned: success Sample:  | |
| Current runtime state of the pool as the module completed. Returned: success Sample:  | 
