Create IIS website with https binding only

Hi,

Ansible 2.6.3

Target hosts: Windows

Guys, could you please tell me if we have possibility to create IIS website using win_iis_website module with HTTPS binding only (without HTTP one) ?

Like I can do this using Powershell (assuming application pool “test” already exists):

New-Website -Name “test” -PhysicalPath “Path_to_site_folder” -Port 443 -ApplicationPool “test” -Ssl

I’ve used next task, but execution failed (assuming application pool “test” already exists):

  • name: Create site
    win_iis_website:
    name: “test”
    physical_path: ‘Path_to_site_folder’
    port: 443
    ssl:
    application_pool: “test”
    state: started

win_iis_website module offers parameter called ssl, but seems like it’s only mentioned among parameters there without actual usage during module execution.

Tell us how it failed - error messages etc…

Actually, module is not failed, but created HTTP binding instead of HTTPS

  • name: Create site
    win_iis_website:
    name: “test”
    physical_path: ‘Path_to_site_folder’
    port: 443
    ssl:
    application_pool: “test”
    state: started

Looks like the ssl parameter is a no-op, it is defined but never used https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/windows/win_iis_website.ps1#L21. You can use the win_iis_webbinding https://docs.ansible.com/ansible/latest/modules/win_iis_webbinding_module.html or win_dsc module with the xWebsite resource instead. An example of how to use DSC can be found here https://docs.ansible.com/ansible/latest/user_guide/windows_dsc.html#setup-iis-website.

Thanks

Jordan

Totally forgot about DSC (and win_dsc).

Thanks a lot, Jordan