Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbirke/ec7e039a81bef23ea1ef688427b4c66f to your computer and use it in GitHub Desktop.
Save gbirke/ec7e039a81bef23ea1ef688427b4c66f 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') }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment