Debian Codegraph @

test/integration/targets/ssh_agent/test_key.yml

raw
1 - ssh_keygen:
2 type: "{{ item }}"
3 passphrase: passphrase
4 register: sshkey
5
6 - slurp:
7 path: ~/.ssh/authorized_keys
8 register: akeys
9
10 - copy:
11 content: |
12 {{ sshkey.public_key }}
13 {{ akeys.content|b64decode }}
14 dest: ~/.ssh/authorized_keys
15 mode: '0400'
16
17 - block:
18 - ping:
19
20 - name: list keys from agent
21 ssh_agent:
22 action: list
23 register: keys
24
25 - assert:
26 that:
27 - keys.nkeys == ansible_loop.index
28 - keys['keys'][ansible_loop.index0].fingerprint == fingerprint
29
30 - name: key already exists in the agent
31 ping:
32 vars:
33 ansible_password: ~
34 ansible_ssh_password: ~
35 ansible_ssh_private_key_file: ~
36 ansible_ssh_private_key: '{{ sshkey.private_key }}'
37 ansible_ssh_private_key_passphrase: passphrase
38 fingerprint: '{{ sshkey.fingerprint }}'