You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/ssh_agent/test_key.yml

39 lines
850 B
YAML

- ssh_keygen:
type: "{{ item }}"
passphrase: passphrase
register: sshkey
- slurp:
path: ~/.ssh/authorized_keys
register: akeys
- copy:
content: |
{{ sshkey.public_key }}
{{ akeys.content|b64decode }}
dest: ~/.ssh/authorized_keys
mode: '0400'
- block:
- ping:
- name: list keys from agent
ssh_agent:
action: list
register: keys
- assert:
that:
- keys.nkeys == ansible_loop.index
- keys['keys'][ansible_loop.index0].fingerprint == fingerprint
- name: key already exists in the agent
ping:
vars:
ansible_password: ~
ansible_ssh_password: ~
ansible_ssh_private_key_file: ~
ansible_ssh_private_key: '{{ sshkey.private_key }}'
ansible_ssh_private_key_passphrase: passphrase
fingerprint: '{{ sshkey.fingerprint }}'