Debian Codegraph @

test/integration/targets/git/tasks/missing_hostkey.yml

raw
1 - name: MISSING-HOSTKEY | checkout ssh://[email protected] repo without accept_hostkey (expected fail)
2 git:
3 repo: '{{ repo_format2 }}'
4 dest: '{{ checkout_dir }}'
5 ssh_opts: '-o UserKnownHostsFile={{ remote_tmp_dir }}/known_hosts'
6 register: git_result
7 ignore_errors: true
8
9 - assert:
10 that:
11 - git_result is failed
12
13 - name: MISSING-HOSTKEY | checkout [email protected] repo with accept_hostkey (expected pass)
14 git:
15 repo: '{{ repo_format2 }}'
16 dest: '{{ checkout_dir }}'
17 accept_hostkey: true
18 key_file: '{{ github_ssh_private_key }}'
19 ssh_opts: '-o UserKnownHostsFile={{ remote_tmp_dir }}/known_hosts'
20 register: git_result
21 when: github_ssh_private_key is defined
22
23 - assert:
24 that:
25 - git_result is changed
26 when: github_ssh_private_key is defined
27
28 - name: MISSING-HOSTKEY | clear checkout_dir
29 file:
30 state: absent
31 path: '{{ checkout_dir }}'
32 when: github_ssh_private_key is defined
33
34 - name: MISSING-HOSTKEY | checkout ssh://[email protected] repo with accept_hostkey (expected pass)
35 git:
36 repo: '{{ repo_format3 }}'
37 dest: '{{ checkout_dir }}'
38 version: >-
39 {{ git_default_branch }}
40 accept_hostkey: false # should already have been accepted
41 key_file: '{{ github_ssh_private_key }}'
42 ssh_opts: '-o UserKnownHostsFile={{ remote_tmp_dir }}/known_hosts'
43 register: git_result
44 when: github_ssh_private_key is defined
45
46 - assert:
47 that:
48 - git_result is changed
49 when: github_ssh_private_key is defined
50
51 - name: MISSING-HOSTEKY | Remove github.com hostkey from known_hosts
52 lineinfile:
53 dest: '{{ remote_tmp_dir }}/known_hosts'
54 regexp: "github.com"
55 state: absent
56 when: github_ssh_private_key is defined
57
58 - name: MISSING-HOSTKEY | clear checkout_dir
59 file:
60 state: absent
61 path: '{{ checkout_dir }}'
62 when: github_ssh_private_key is defined