diff --git a/source_control/git b/source_control/git index b769776a3a4..768e315788a 100644 --- a/source_control/git +++ b/source_control/git @@ -49,6 +49,8 @@ options: version_added: "1.5" description: - Add the hostkey for the repo url if not already added. + If ssh_args contains "-o StrictHostKeyChecking=no", this + parameter is ignored. ssh_opts: required: false default: None @@ -445,8 +447,11 @@ def main(): set_git_ssh(ssh_wrapper, key_file, ssh_opts) # add the git repo's hostkey - #if module.params['accept_hostkey']: - add_git_host_key(module, repo, accept_hostkey=module.params['accept_hostkey']) + if module.params['ssh_opts'] is not None: + if not "-o StrictHostKeyChecking=no" in module.params['ssh_opts']: + add_git_host_key(module, repo, accept_hostkey=module.params['accept_hostkey']) + else: + add_git_host_key(module, repo, accept_hostkey=module.params['accept_hostkey']) if bare: gitconfig = os.path.join(dest, 'config')