diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 0f9906bb314..4b716242481 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -662,7 +662,7 @@ class Runner(object): basetmp = os.path.join('/tmp', basefile) cmd = 'mkdir -p %s' % basetmp - if self.remote_user != 'root': + if self.remote_user != 'root' or (self.sudo and self.sudo_user != 'root'): cmd += ' && chmod a+rx %s' % basetmp cmd += ' && echo %s' % basetmp