Open ygo74 opened 4 years ago
the issue is you can't compare a boolean value with a string value, the powershell result of this comparison is always false so attribute is never updated
sample of potential fix :
# Set properties
if($parameters) {
$parameters | ForEach-Object {
$property_value = Get-ItemProperty "IIS:\Sites\$($site.Name)" $_[0]
switch ($property_value.GetType().Name)
{
"ConfigurationAttribute" { $parameter_value = $property_value.value }
"String" { $parameter_value = $property_value }
}
# Fix space after split of parameters
$inputValue = $_[1]
if ($null -ne $inputValue) {$inputValue = $inputValue.Trim()}
# Fix Boolean
if ($parameter_value.GetType().FullName -eq "System.Boolean")
{
$inputValue = [System.Convert]::ToBoolean($inputValue)
}
if((-not $parameter_value) -or ($parameter_value) -ne $inputValue) {
Set-ItemProperty -LiteralPath "IIS:\Sites\$($site.Name)" $_[0] $inputValue
$result.changed = $true
}
}
}
Hello,
I'm updating my roles to be compatible with ansible 2.10 / python 3. I found that I have a workaround in my role (this solution) and I see my open issue stills opened 👎 Could I have a reply ? Maybe closed in ansible windows collection xx.xx ?
SUMMARY
I'm not able to update the boolean attribute serverAutoStart with module win_iis_website
ISSUE TYPE
COMPONENT NAME
win_iis_website
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
All Windows versions
STEPS TO REPRODUCE
or
EXPECTED RESULTS
I expect that serverAutoStart attribute is updated to true or false C:\Windows\System32\inetsrv\appcmd.exe list SITE test /config:* /xml
ACTUAL RESULTS
It changes only the website state but not he serverAutoStart attribute