mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 21:31:26 -07:00
Squashed commit of the following, plus some streamlining (MPD).
commit e00368e7c65c65bed11fcaaf83fe8b093dbf492e Merge: 2ea7110 c039aa0 Author: Michael DeHaan <michael.dehaan@gmail.com> Date: Thu May 10 01:43:10 2012 -0400 Merge branch 'devel' of https://github.com/weaselkeeper/ansible into weaselkeeper-devel commit c039aa091582cd31e206692df6f4f148394b41d6 Author: Jim Richardson <weaselkeeper@gmail.com> Date: Fri May 11 17:55:13 2012 -0700 cleanup and simplification of ANSIBLE_REMOTE_TMP feature commit d87f15b796b799c375808edc7cc0932d7809d325 Merge: 5917aba 4c2fd25 Author: Jim Richardson <weaselkeeper@gmail.com> Date: Fri May 11 17:30:16 2012 -0700 Merge branch 'devel' of github.com:weaselkeeper/ansible into devel commit 5917aba761af2e4163772d2d74e7efc0d169273a Author: Jim Richardson <jrichardson@classmates.com> Date: Wed May 9 11:25:45 2012 -0700 ANSIBLE_REMOTE_TMP environment variable sets where ansible will stuf tmp files on remote host. Default is /var/tmp for root, and $HOME/.ansible/tmp for non-root commit 4c2fd2577769a6392187585828168bcb4a1476da Author: Jim Richardson <jrichardson@classmates.com> Date: Wed May 9 11:25:45 2012 -0700 ANSIBLE_REMOTE_TMP environment variable sets where ansible will stuf tmp files on remote host. Default is /var/tmp for root, and $HOME/.ansible/tmp for non-root
This commit is contained in:
parent
ccab8ac2c0
commit
60d44e1a01
2 changed files with 7 additions and 9 deletions
|
@ -247,13 +247,13 @@ class Runner(object):
|
|||
if self.remote_user == 'root':
|
||||
args = "%s metadata=/etc/ansible/setup" % args
|
||||
else:
|
||||
args = "%s metadata=$HOME/.ansible/setup" % args
|
||||
args = "%s metadata=%s/.ansible/setup" % (args, C.DEFAULT_REMOTE_TMP)
|
||||
else:
|
||||
if not 'metadata' in args:
|
||||
if self.remote_user == 'root':
|
||||
args['metadata'] = '/etc/ansible/setup'
|
||||
else:
|
||||
args['metadata'] = "$HOME/.ansible/setup"
|
||||
args['metadata'] = "%s/.ansible/setup" % C.DEFAULT_REMOTE_TMP
|
||||
return args
|
||||
|
||||
# *****************************************************
|
||||
|
@ -667,13 +667,9 @@ class Runner(object):
|
|||
def _get_tmp_path(self, conn):
|
||||
''' gets a temporary path on a remote box '''
|
||||
|
||||
# The problem with this is that it's executed on the
|
||||
# overlord, not on the target so we can't use tempdir and os.path
|
||||
# Only support the *nix world for now by using the $HOME env var
|
||||
|
||||
basetmp = "/var/tmp"
|
||||
if self.remote_user != 'root':
|
||||
basetmp = "$HOME/.ansible/tmp"
|
||||
basetmp = C.DEFAULT_REMOTE_TMP
|
||||
if self.remote_user == 'root':
|
||||
basetmp ="/var/tmp"
|
||||
cmd = "mktemp -d %s/ansible.XXXXXX" % basetmp
|
||||
if self.remote_user != 'root':
|
||||
cmd = "mkdir -p %s && %s" % (basetmp, cmd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue