diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 20fcdc9b1d..b6ee8880fb 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -47,6 +47,7 @@ PASS_VARS = { 'shell_executable': '_shell', 'socket': '_socket_path', 'syslog_facility': '_syslog_facility', + 'tempdir': 'tempdir', 'verbosity': '_verbosity', 'version': 'ansible_version', } @@ -845,9 +846,6 @@ class AnsibleModule(object): self._legal_inputs = ['_ansible_%s' % k for k in PASS_VARS] self._options_context = list() - # set tempdir to remote tmp - self.tempdir = os.environ.get('ANSIBLE_REMOTE_TEMP', None) - if add_file_common_args: for k, v in FILE_COMMON_ARGUMENTS.items(): if k not in self.argument_spec: diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 27f858d024..ce0f26f7a4 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -631,6 +631,9 @@ class ActionBase(with_metaclass(ABCMeta, object)): # make sure all commands use the designated shell executable module_args['_ansible_shell_executable'] = self._play_context.executable + # make sure all commands use the designated temporary directory + module_args['_ansible_tempdir'] = self._connection._shell.tempdir + def _update_connection_options(self, options, variables=None): ''' ensures connections have the appropriate information ''' update = {}