Skip to content

Instantly share code, notes, and snippets.

@feiz
Created October 16, 2014 09:31
Show Gist options
  • Save feiz/f216762d7741ed5b4c9a to your computer and use it in GitHub Desktop.
Save feiz/f216762d7741ed5b4c9a to your computer and use it in GitHub Desktop.
リモートでssh-keygenして別のホストにpubkeyを設定する
- hosts: foo
tasks:
- command: ssh-keygen ...
- fetch:
src: ~/.ssh/id_rsa.pub
dest: _pubkey
- hosts: bar
tasks:
- authorized_key:
key: "{{ lookup('file', '_pubkey') }}"
user: www
- hosts: 127.0.0.1
connection: local
tasks:
- command: rm _pubkey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment