Skip to content

Commit

Permalink
Fix ansible#6346. Add key_file and accept_hostkey to ansible-pull
Browse files Browse the repository at this point in the history
Signed-off-by: Max Riveiro <[email protected]>
  • Loading branch information
kavu committed Jan 31, 2015
1 parent 4fb7c1b commit 9e8dae7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/ansible-pull
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

import os
import shutil
import subprocess
import sys
import datetime
import socket
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9e8dae7

Please sign in to comment.