mirror of
https://github.com/ansible/ansible.git
synced 2025-11-30 23:16:08 +07:00
* Add ssh-agent launching, and ssh-agent python client * Move things around, is this better?? * docs * postpone creating dir after bin lookup * fix method name * changelog ssh agent * address reviews * fix typing * do not redefine public_key * typing * more typing * Catch OSError when starting ssh agent * likely copy pasted old code * var type fix * why is this needed? ci_complete * ignoring the change for now * write out pub key file atomically * defensive timeout for the socket * _populate_agent docstring * do not allow setting these in config * check expected length before slicing blobs * test all key types * remove lock/unlock functionality * docstring * private _ssh_agent * . * launch agent in cli and ansible_ssh_* * additional info for ssh-agent comment * Add tests for remove and remove_all * comment on os.rename * hopefully mitigate agent startup/delays problems * exceptions * unused import * fix sanity * perf --------- Co-authored-by: Matt Martz <matt@sivel.net>
39 lines
850 B
YAML
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 }}'
|