summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Coca <bcoca@ansible.com>2015-02-02 09:48:41 -0500
committerBrian Coca <bcoca@ansible.com>2015-02-02 09:48:41 -0500
commit4198b0a9a5e40371e9b5658d952a850e43598633 (patch)
tree05c2f313fed837c676fd349aaae3dfe3aa3a649d
parent3d858b7c02be3703aea7329436e7c77d818028f7 (diff)
parent9e8dae749886b04126fb249e48b4e8a16a90770a (diff)
downloadansible-4198b0a9a5e40371e9b5658d952a850e43598633.tar.gz
Merge pull request #6641 from kavu/6346_accept_hostkey_and_key_file
Add key_file and accept_hostkey to ansible-pull
-rwxr-xr-xbin/ansible-pull14
1 files changed, 13 insertions, 1 deletions
diff --git a/bin/ansible-pull b/bin/ansible-pull
index 67b969fdae..0cea19fb35 100755
--- a/bin/ansible-pull
+++ b/bin/ansible-pull
@@ -40,7 +40,6 @@
import os
import shutil
-import subprocess
import sys
import datetime
import socket
@@ -137,6 +136,10 @@ def main(args):
help='ask for sudo password')
parser.add_option('-t', '--tags', dest='tags', default=False,
help='only run plays and tasks tagged with these values')
+ parser.add_option('--accept-host-key', default=False, dest='accept_host_key', action='store_true',
+ help='adds the hostkey for the repo url if not already added')
+ parser.add_option('--key-file', dest='key_file',
+ help="Pass '-i <key_file>' to the SSH arguments used by git.")
options, args = parser.parse_args(args)
hostname = socket.getfqdn()
@@ -170,6 +173,15 @@ def main(args):
if options.checkout:
repo_opts += ' version=%s' % options.checkout
+
+ # Only git module is supported
+ if options.module_name == DEFAULT_REPO_TYPE:
+ if options.accept_host_key:
+ repo_opts += ' accept_hostkey=yes'
+
+ if options.key_file:
+ repo_opts += ' key_file=%s' % options.key_file
+
path = utils.plugins.module_finder.find_plugin(options.module_name)
if path is None:
sys.stderr.write("module '%s' not found.\n" % options.module_name)