Hello! I am creating a bunch of IIS web sites under a web application and for some reason the community.windows.win_iis_webapplication module shows that it changes the web apps every time it is executed.
Here is my play:
- name: "Create the web apps"
community.windows.win_iis_webapplication:
name: '{{ item.virtual_path }}'
site: '{{ my_site_web_site.name }}'
state: present
physical_path: '{{ item.folder_path }}'
application_pool: '{{ my_site_app_pool.name }}'
loop: '{{ my_site_web_apps }}'
notify: 'Restart web site: {{ my_site_web_site.name }}'
Here’s what my vars look like:
---
debug: false
my_site_app_pool:
name: My-Default
auto_start: false
my_site_web_site:
name: '{{ my_site_app_pool.name }}'
path: 'D:\Inetpub\{{ my_site_app_pool.name }}'
url: my-default.example.com
my_site_web_apps:
- virtual_path: 'App1'
folder_path: '{{ my_site_web_site.path }}/App1'
- virtual_path: 'App2'
folder_path: '{{ my_site_web_site.path }}/App2'
Here’s my output for one of the web apps that I see in AWX:
{
"changed": true,
"connect_as": "pass_through",
"physical_path": "D:\\Inetpub\\My-Default/App1",
"application_pool": "My-Default",
"_ansible_no_log": false,
"item": {
"virtual_path": "App1",
"folder_path": "D:\\Inetpub\\My-Default/App1"
},
"ansible_loop_var": "item",
"_ansible_item_label": {
"virtual_path": "App1",
"folder_path": "D:\\Inetpub\\My-Default/App1"
}
}
Finally, here’s what I get when I interrogate the web app using a one-liner:
# Output of this command:
# ansible --ask-vault-pass -i hosts.ini -m community.windows.win_iis_webapplication -a "name='App1' site='My-Default'" my-server
wi-web19d | SUCCESS => {
"application_pool": "My-Default",
"changed": false,
"connect_as": "pass_through",
"physical_path": "D:\\Inetpub\\My-Default/App1"
}
I’ve run this play a half-dozen times on the same server and it shows as changed every time. This makes little sense to me because everything looks idempotent to me.
What am I doing wrong?

