mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 10:30:03 -03:30
AC-932 Support accept_hostkey option to git module when using ansible >= 1.5.
This commit is contained in:
parent
dbd0f46435
commit
8aa9fe9d7e
@ -629,6 +629,17 @@ class RunProjectUpdate(BaseTask):
|
||||
scm_password = False
|
||||
scm_url = update_scm_url(scm_type, scm_url, scm_username,
|
||||
scm_password)
|
||||
|
||||
# When using Ansible >= 1.5, pass the extra accept_hostkey parameter to
|
||||
# the git module.
|
||||
if scm_type == 'git' and scm_url_parts.scheme == 'ssh':
|
||||
try:
|
||||
Version = distutils.version.StrictVersion
|
||||
if Version(get_ansible_version()) >= Version('1.5'):
|
||||
extra_vars['scm_accept_hostkey'] = 'true'
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
return scm_url, extra_vars
|
||||
|
||||
def build_args(self, project_update, **kwargs):
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
# scm_delete_on_update: true/false
|
||||
# scm_username: username (only for svn)
|
||||
# scm_password: password (only for svn)
|
||||
# scm_accept_hostkey: true/false (only for git)
|
||||
|
||||
- hosts: all
|
||||
connection: local
|
||||
@ -19,9 +20,13 @@
|
||||
file: path="{{project_path}}" state=absent
|
||||
when: scm_delete_on_update|default('')
|
||||
|
||||
- name: update project using git and accept hostkey
|
||||
git: dest="{{project_path}}" repo="{{scm_url}}" version="{{scm_branch}}" force={{scm_clean}} accept_hostkey={{scm_accept_hostkey}}
|
||||
when: scm_type == 'git' and scm_accept_hostkey is defined
|
||||
|
||||
- name: update project using git
|
||||
git: dest="{{project_path}}" repo="{{scm_url}}" version="{{scm_branch}}" force={{scm_clean}}
|
||||
when: scm_type == 'git'
|
||||
when: scm_type == 'git' and scm_accept_hostkey is not defined
|
||||
|
||||
- name: update project using hg
|
||||
hg: dest="{{project_path}}" repo="{{scm_url}}" revision="{{scm_branch}}" force={{scm_clean}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user