mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update git test to not rm ~/.ssh/known_hosts.
This commit is contained in:
parent
02311604c9
commit
cbb5d1e5d5
3 changed files with 8 additions and 12 deletions
|
@ -18,9 +18,6 @@ gce_project_id:
|
||||||
azure_subscription_id: "{{ lookup('env', 'AZURE_SUBSCRIPTION_ID') }}"
|
azure_subscription_id: "{{ lookup('env', 'AZURE_SUBSCRIPTION_ID') }}"
|
||||||
azure_cert_path: "{{ lookup('env', 'AZURE_CERT_PATH') }}"
|
azure_cert_path: "{{ lookup('env', 'AZURE_CERT_PATH') }}"
|
||||||
|
|
||||||
# GITHUB SSH private key - a path to a SSH private key for use with github.com
|
|
||||||
github_ssh_private_key: "{{ lookup('env','HOME') }}/.ssh/id_rsa"
|
|
||||||
|
|
||||||
# Cloudflare Credentials
|
# Cloudflare Credentials
|
||||||
cloudflare_api_token:
|
cloudflare_api_token:
|
||||||
cloudflare_email:
|
cloudflare_email:
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: remove known_host files
|
|
||||||
file:
|
|
||||||
state: absent
|
|
||||||
path: '{{ item }}'
|
|
||||||
with_items: "{{known_host_files}}"
|
|
||||||
|
|
||||||
- name: checkout ssh://git@github.com repo without accept_hostkey (expected fail)
|
- name: checkout ssh://git@github.com repo without accept_hostkey (expected fail)
|
||||||
git:
|
git:
|
||||||
repo: '{{ repo_format2 }}'
|
repo: '{{ repo_format2 }}'
|
||||||
dest: '{{ checkout_dir }}'
|
dest: '{{ checkout_dir }}'
|
||||||
|
ssh_opts: '-o UserKnownHostsFile={{ output_dir }}/known_hosts'
|
||||||
register: git_result
|
register: git_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
|
@ -23,19 +18,20 @@
|
||||||
dest: '{{ checkout_dir }}'
|
dest: '{{ checkout_dir }}'
|
||||||
accept_hostkey: true
|
accept_hostkey: true
|
||||||
key_file: '{{ github_ssh_private_key }}'
|
key_file: '{{ github_ssh_private_key }}'
|
||||||
|
ssh_opts: '-o UserKnownHostsFile={{ output_dir }}/known_hosts'
|
||||||
register: git_result
|
register: git_result
|
||||||
when: github_ssh_private_key is defined
|
when: github_ssh_private_key is defined
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- 'git_result.changed'
|
- 'git_result.changed'
|
||||||
when: not git_result|skipped
|
when: github_ssh_private_key is defined
|
||||||
|
|
||||||
|
|
||||||
- name: clear checkout_dir
|
- name: clear checkout_dir
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: '{{ checkout_dir }}'
|
path: '{{ checkout_dir }}'
|
||||||
|
when: github_ssh_private_key is defined
|
||||||
|
|
||||||
- name: checkout ssh://git@github.com repo with accept_hostkey (expected pass)
|
- name: checkout ssh://git@github.com repo with accept_hostkey (expected pass)
|
||||||
git:
|
git:
|
||||||
|
@ -44,10 +40,11 @@
|
||||||
version: 'master'
|
version: 'master'
|
||||||
accept_hostkey: false # should already have been accepted
|
accept_hostkey: false # should already have been accepted
|
||||||
key_file: '{{ github_ssh_private_key }}'
|
key_file: '{{ github_ssh_private_key }}'
|
||||||
|
ssh_opts: '-o UserKnownHostsFile={{ output_dir }}/known_hosts'
|
||||||
register: git_result
|
register: git_result
|
||||||
when: github_ssh_private_key is defined
|
when: github_ssh_private_key is defined
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- 'git_result.changed'
|
- 'git_result.changed'
|
||||||
when: not git_result|skipped
|
when: github_ssh_private_key is defined
|
||||||
|
|
|
@ -18,3 +18,5 @@ known_host_files:
|
||||||
- '/etc/ssh/ssh_known_hosts'
|
- '/etc/ssh/ssh_known_hosts'
|
||||||
git_version_supporting_depth: 1.9.1
|
git_version_supporting_depth: 1.9.1
|
||||||
git_version_supporting_ls_remote: 1.7.5
|
git_version_supporting_ls_remote: 1.7.5
|
||||||
|
# path to a SSH private key for use with github.com (tests skipped if undefined)
|
||||||
|
# github_ssh_private_key: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa"
|
||||||
|
|
Loading…
Reference in a new issue