@ -332,18 +332,18 @@ class ActionBase(with_metaclass(ABCMeta, object)):
Create and return a temporary path on a remote box .
'''
become_unprivileged = self . _is_become_unprivileged ( )
remote_tmp = self . get_shell_option ( ' remote_tmp ' , default = ' ~/.ansible/tmp ' )
# deal with tmpdir creation
basefile = ' ansible-tmp- %s - %s ' % ( time . time ( ) , random . randint ( 0 , 2 * * 48 ) )
# Network connection plugins (network_cli, netconf, etc.) execute on the controller, rather than the remote host.
# As such, we want to avoid using remote_user for paths as remote_user may not line up with the local user
# This is a hack and should be solved by more intelligent handling of remote_tmp in 2.7
if getattr ( self . _connection , ' _remote_is_local ' , False ) :
tmpdir = C . DEFAULT_LOCAL_TMP
else :
tmpdir = self . _remote_expand_user ( remote_tmp , sudoable = False )
# NOTE: shell plugins should populate this setting anyways, but they dont do remote expansion, which
# we need for 'non posix' systems like cloud-init and solaris
tmpdir = self . _remote_expand_user ( self . get_shell_option ( ' remote_tmp ' , default = ' ~/.ansible/tmp ' ) , sudoable = False )
become_unprivileged = self . _is_become_unprivileged ( )
basefile = self . _connection . _shell . _generate_temp_dir_name ( )
cmd = self . _connection . _shell . mkdtemp ( basefile = basefile , system = become_unprivileged , tmpdir = tmpdir )
result = self . _low_level_execute_command ( cmd , sudoable = False )
@ -362,9 +362,9 @@ class ActionBase(with_metaclass(ABCMeta, object)):
elif u ' No space left on device ' in result [ ' stderr ' ] :
output = result [ ' stderr ' ]
else :
output = ( ' Authentication or permission failure. '
output = ( ' Failed to create temporary directory. '
' In some cases, you may have been able to authenticate and did not have permissions on the target directory. '
' Consider changing the remote tmp path in ansible.cfg to a path rooted in " /tmp " . '
' Consider changing the remote tmp path in ansible.cfg to a path rooted in " /tmp " , for more error information use -vvv . '
' Failed command was: %s , exited with result %d ' % ( cmd , result [ ' rc ' ] ) )
if ' stdout ' in result and result [ ' stdout ' ] != u ' ' :
output = output + u " , stdout output: %s " % result [ ' stdout ' ]