diff --git a/lib/ansible/modules/windows/win_stat.ps1 b/lib/ansible/modules/windows/win_stat.ps1 index 32358cb516..38480208c0 100644 --- a/lib/ansible/modules/windows/win_stat.ps1 +++ b/lib/ansible/modules/windows/win_stat.ps1 @@ -78,7 +78,9 @@ $checksum_algorithm = Get-AnsibleParam -obj $params -name "checksum_algorithm" - $result = @{ changed = $false - stat = @{} + stat = @{ + exists = $false + } } # Backward compatibility @@ -93,6 +95,7 @@ If (Test-Path -Path $path) # Initial values $result.stat.isdir = $false $result.stat.islnk = $false + $result.stat.isreg = $false $result.stat.isshared = $false # Need to use -Force so it picks up hidden files @@ -160,8 +163,9 @@ If (Test-Path -Path $path) } Else { - $result.stat.size = $info.Length $result.stat.extension = $info.Extension + $result.stat.isreg = $true + $result.stat.size = $info.Length If ($get_md5) { $result.stat.md5 = Get-FileChecksum -path $path -algorithm "md5" @@ -172,9 +176,5 @@ If (Test-Path -Path $path) } } } -Else -{ - $result.stat.exists = $false -} Exit-Json $result diff --git a/lib/ansible/modules/windows/win_stat.py b/lib/ansible/modules/windows/win_stat.py index 6e805e4087..fab87c8884 100644 --- a/lib/ansible/modules/windows/win_stat.py +++ b/lib/ansible/modules/windows/win_stat.py @@ -173,6 +173,11 @@ stat: returned: success, path exists type: boolean sample: True + isreg: + description: if the path is a regular file + returned: success, path exists + type: boolean + sample: True isshared: description: if the path is shared or not returned: success, path exists