diff options
-rw-r--r-- | lib/ansible/plugins/action/__init__.py | 3 | ||||
-rw-r--r-- | lib/ansible/plugins/shell/__init__.py | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 8f92325395..5f83e29a66 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -820,6 +820,9 @@ class ActionBase(ABC): ''' cmd = self._connection._shell.set_user_facl(paths, user, mode) res = self._low_level_execute_command(cmd, sudoable=sudoable) + if res['rc'] != 0: + cmd = self._connection._shell.set_user_facl_nfs(paths, user, mode) + res = self._low_level_execute_command(cmd, sudoable=sudoable) return res def _execute_remote_stat(self, path, all_vars, follow, tmp=None, checksum=True): diff --git a/lib/ansible/plugins/shell/__init__.py b/lib/ansible/plugins/shell/__init__.py index d5db261f68..766d731652 100644 --- a/lib/ansible/plugins/shell/__init__.py +++ b/lib/ansible/plugins/shell/__init__.py @@ -127,6 +127,14 @@ class ShellBase(AnsiblePlugin): return ' '.join(cmd) + def set_user_facl_nfs(self, paths, user, mode): + """Sets nfs acls for users. Should perhaps be in suffix-less function""" + cmd = ['setfacl', '-m', 'u:%s:%s::allow' % (user, mode)] + cmd.extend(paths) + cmd = [shlex.quote(c) for c in cmd] + + return ' '.join(cmd) + def remove(self, path, recurse=False): path = shlex.quote(path) cmd = 'rm -f ' |