IIS Application Pool - Specific Identity

Is it possible to use Ansible to create a new IIS Application Pool that runs under a specific “identity”?

Cheers

Yes, but its two steps at the moment and the second step isn’t idempotent.

Try something like this:

create the app pool first

  • name: Update/Create DefaultAppPool
    win_iis_webapppool:
    name: ‘DefaultAppPool’
    state: started
    attributes: managedRuntimeVersion:v4.0|enable32BitAppOnWin64:true
    register: DefaultAppPool

then switch to running as a (domain) user

  • name: configure listed app pools to run as correct user
    win_command: ‘C:\Windows\System32\inetsrv\appcmd.exe set config /section:applicationPools "/[name=’‘{{ item }}’‘].processModel.identityType:SpecificUser" "/[name=’‘{{ item }}’‘].processModel.userName:{{ fdomain }}{{ user }}" "/[name=’‘{{ item }}’‘].processModel.password:{{ credential }}"’
    with_items:
  • DefaultAppPool
  • SomeOtherAppPool