Skip to content

Instantly share code, notes, and snippets.

@shohey1226
Created March 1, 2014 02:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shohey1226/9283994 to your computer and use it in GitHub Desktop.
Save shohey1226/9283994 to your computer and use it in GitHub Desktop.
Ansible playbook add user using public ssh key on Github
---
- name: add user and create ssh key
user: name=shohei
- name: dowanload pubkey from Github and placed as authorized_keys
get_url: url=https://github.com/shohey1226.keys dest=/tmp/shohei.authorized_keys
delegate_to: 127.0.0.1
- name: Create authorized_keys from the file that just downloaded
authorized_key: user=shohei key="{{ lookup('file', '/tmp/shohei.authorized_keys') }}"
@toddlers
Copy link

toddlers commented Jul 8, 2017

---   
      - name: add user and create ssh key
        user: name=sureshp
      - name: create authorized_keys from file that just downloaded
        authorized_key: user=sureshp key=https://github.com/toddlers.keys

This seems cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment