summaryrefslogtreecommitdiff
path: root/bin/ansible-pull
diff options
context:
space:
mode:
authorMichael Scherer <misc@zarb.org>2013-10-16 09:03:43 +0200
committerMichael Scherer <misc@zarb.org>2013-10-18 02:05:41 +0200
commitf8b23e5721bed34a6eedb616a81ceb0a3694ed4b (patch)
tree2cd4c8d7253c971a102a424aa82a2f202d2fb70f /bin/ansible-pull
parentb0f6e77f66f77cc3765f3f084d9a9b19a041b815 (diff)
downloadansible-f8b23e5721bed34a6eedb616a81ceb0a3694ed4b.tar.gz
add a default value for the -d option of ansible-pull
Thi permit to simplify the command line to use by using a sensible default, and so reduce the number of incorrect possible choices and setup needed. Among potential incorrect choices is using a fixed directory in /tmp, which could be problematic with a setup whose access is not properly restricted.
Diffstat (limited to 'bin/ansible-pull')
-rwxr-xr-xbin/ansible-pull7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/ansible-pull b/bin/ansible-pull
index 4e1ff7e646..4dd8497c7d 100755
--- a/bin/ansible-pull
+++ b/bin/ansible-pull
@@ -122,9 +122,10 @@ def main(args):
'Default is %s.' % DEFAULT_REPO_TYPE)
options, args = parser.parse_args(args)
+ hostname = socket.getfqdn()
if not options.dest:
- parser.error("Missing required directory argument")
- return 1
+ # use a hostname dependent directory, in case of $HOME on nfs
+ options.dest = utils.prepare_writeable_dir('~/.ansible/pull/%s' % hostname)
options.dest = os.path.abspath(options.dest)
@@ -136,7 +137,7 @@ def main(args):
print >>sys.stderr, now.strftime("Starting ansible-pull at %F %T")
inv_opts = 'localhost,'
- limit_opts = 'localhost:%s:127.0.0.1' % socket.getfqdn()
+ limit_opts = 'localhost:%s:127.0.0.1' % hostname
base_opts = '-c local --limit "%s"' % limit_opts
repo_opts = "name=%s dest=%s" % (options.url, options.dest)
if options.checkout: