Files
ansible/test/integration/targets/git/tasks/missing_hostkey.yml
Matt Martz e40a0e5c90 Don't use output_dir in target tests (#76107)
* Don't use output_dir in user tests

* Move blockinfile tests from using output_dir to depending on setup_remote_tmp_dir

* Don't use output_dir in git tests

* Don't use output_dir in uri tests
2021-10-21 10:59:48 -05:00

62 lines
1.8 KiB
YAML

- name: MISSING-HOSTKEY | checkout ssh://git@github.com repo without accept_hostkey (expected fail)
git:
repo: '{{ repo_format2 }}'
dest: '{{ checkout_dir }}'
ssh_opts: '-o UserKnownHostsFile={{ remote_tmp_dir }}/known_hosts'
register: git_result
ignore_errors: true
- assert:
that:
- git_result is failed
- name: MISSING-HOSTKEY | checkout git@github.com repo with accept_hostkey (expected pass)
git:
repo: '{{ repo_format2 }}'
dest: '{{ checkout_dir }}'
accept_hostkey: true
key_file: '{{ github_ssh_private_key }}'
ssh_opts: '-o UserKnownHostsFile={{ remote_tmp_dir }}/known_hosts'
register: git_result
when: github_ssh_private_key is defined
- assert:
that:
- git_result is changed
when: github_ssh_private_key is defined
- name: MISSING-HOSTKEY | clear checkout_dir
file:
state: absent
path: '{{ checkout_dir }}'
when: github_ssh_private_key is defined
- name: MISSING-HOSTKEY | checkout ssh://git@github.com repo with accept_hostkey (expected pass)
git:
repo: '{{ repo_format3 }}'
dest: '{{ checkout_dir }}'
version: 'master'
accept_hostkey: false # should already have been accepted
key_file: '{{ github_ssh_private_key }}'
ssh_opts: '-o UserKnownHostsFile={{ remote_tmp_dir }}/known_hosts'
register: git_result
when: github_ssh_private_key is defined
- assert:
that:
- git_result is changed
when: github_ssh_private_key is defined
- name: MISSING-HOSTEKY | Remove github.com hostkey from known_hosts
lineinfile:
dest: '{{ remote_tmp_dir }}/known_hosts'
regexp: "github.com"
state: absent
when: github_ssh_private_key is defined
- name: MISSING-HOSTKEY | clear checkout_dir
file:
state: absent
path: '{{ checkout_dir }}'
when: github_ssh_private_key is defined