suggestions by @marcind
This commit is contained in:
parent
95862793d0
commit
8de49a5dea
2 changed files with 5 additions and 5 deletions
|
@ -26,7 +26,7 @@ $result = New-Object PSObject;
|
||||||
Set-Attr $result "changed" $false;
|
Set-Attr $result "changed" $false;
|
||||||
|
|
||||||
$path = Get-Attr $params "path" -failifempty $true
|
$path = Get-Attr $params "path" -failifempty $true
|
||||||
$copy = Get-Attr $params "copy" "no" -validateSet "no","yes" -resultobj $result
|
$copy = Get-Attr $params "copy" "no" -validateSet "no","yes" -resultobj $result | ConvertTo-Bool
|
||||||
|
|
||||||
If (-Not (Test-Path -Path $path)) {
|
If (-Not (Test-Path -Path $path)) {
|
||||||
Fail-Json $result "$path file or directory does not exist on the host"
|
Fail-Json $result "$path file or directory does not exist on the host"
|
||||||
|
@ -36,7 +36,7 @@ Try {
|
||||||
$objACL = Get-ACL $path
|
$objACL = Get-ACL $path
|
||||||
$alreadyDisabled = !$objACL.AreAccessRulesProtected
|
$alreadyDisabled = !$objACL.AreAccessRulesProtected
|
||||||
|
|
||||||
If ($copy -eq "yes") {
|
If ($copy) {
|
||||||
$objACL.SetAccessRuleProtection($True, $True)
|
$objACL.SetAccessRuleProtection($True, $True)
|
||||||
} Else {
|
} Else {
|
||||||
$objACL.SetAccessRuleProtection($True, $False)
|
$objACL.SetAccessRuleProtection($True, $False)
|
||||||
|
|
|
@ -27,7 +27,7 @@ module: win_acl_inheritance
|
||||||
version_added: "2.0"
|
version_added: "2.0"
|
||||||
short_description: Disable ACL inheritance
|
short_description: Disable ACL inheritance
|
||||||
description:
|
description:
|
||||||
- Disable ACL inheritance and optionally converts ACE to dedicated ACE
|
- Disable ACL (Access Control List) inheritance and optionally converts ACE (Access Control Entry) to dedicated ACE
|
||||||
options:
|
options:
|
||||||
path:
|
path:
|
||||||
description:
|
description:
|
||||||
|
@ -48,12 +48,12 @@ EXAMPLES = '''
|
||||||
# Playbook example
|
# Playbook example
|
||||||
---
|
---
|
||||||
- name: Disable and copy
|
- name: Disable and copy
|
||||||
win_owner:
|
win_acl_inheritance:
|
||||||
path: 'C:\\apache\\'
|
path: 'C:\\apache\\'
|
||||||
copy: yes
|
copy: yes
|
||||||
|
|
||||||
- name: Disable
|
- name: Disable
|
||||||
win_owner:
|
win_acl_inheritance:
|
||||||
path: 'C:\\apache\\'
|
path: 'C:\\apache\\'
|
||||||
copy: no
|
copy: no
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue