Created
September 10, 2015 13:19
-
-
Save mgedmin/86595f4a80cc2f087488 to your computer and use it in GitHub Desktop.
Creating and distributing SSH keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: ssh private key for pushing backups | |
command: ssh-keygen -q -t rsa -N '' -f {{ backup_pusher_key }} -C backup-script@{{ ansible_fqdn }} | |
args: | |
creates: "{{ backup_pusher_key }}" | |
tags: [ backups, ssh ] | |
- name: get the ssh public key | |
command: cat "{{ backup_pusher_key }}.pub" | |
register: pubkey_result | |
changed_when: false | |
always_run: yes | |
tags: [ backups, ssh ] | |
- name: install ssh public key on the backup buddy | |
authorized_key: key="{{ pubkey_result.stdout }}" user=uploader state=present | |
delegate_to: "{{ backup_buddy }}" | |
tags: [ backups, ssh ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment