Created
April 19, 2019 14:31
-
-
Save tjbenator/b5c8df7d25ff14a5ea09096839bf2b56 to your computer and use it in GitHub Desktop.
Distribute SSH keys from your Github Account
This file contains 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
- hosts: all | |
tasks: | |
- name: Get SSH Keys | |
uri: | |
url: https://api.github.com/users/tjbenator/keys | |
method: GET | |
return_content: yes | |
register: ssh_keys | |
- name: Add keys to authorized_keys file | |
lineinfile: | |
path: "/home/travis/.ssh/authorized_keys" | |
line: "{{ item['key'] }}" | |
create: yes | |
validate: 'ssh-keygen -lf %s' | |
with_items: "{{ (ssh_keys.content|from_json) }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment