diff --git a/changelogs/fragments/win_iis_website-restarted.yaml b/changelogs/fragments/win_iis_website-restarted.yaml new file mode 100644 index 00000000000..22f843995fb --- /dev/null +++ b/changelogs/fragments/win_iis_website-restarted.yaml @@ -0,0 +1,2 @@ +bugfixes: +- win_iis_website - Actually restart the site when ``state=restarted`` - https://github.com/ansible/ansible/issues/63828 diff --git a/lib/ansible/modules/windows/win_iis_website.ps1 b/lib/ansible/modules/windows/win_iis_website.ps1 index 7986baa8612..e7b6cab8bf6 100644 --- a/lib/ansible/modules/windows/win_iis_website.ps1 +++ b/lib/ansible/modules/windows/win_iis_website.ps1 @@ -143,7 +143,7 @@ Try { } # Set run state - if (($state -eq 'stopped') -and ($site.State -eq 'Started')) + if ((($state -eq 'stopped') -or ($state -eq 'restarted')) -and ($site.State -eq 'Started')) { Stop-Website -Name $name -ErrorAction Stop $result.changed = $true