Skip to content

Instantly share code, notes, and snippets.

@ridingintraffic
Created August 19, 2017 13:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ridingintraffic/a89b8a27cb6b9148c5bf7f9dd4294c35 to your computer and use it in GitHub Desktop.
Save ridingintraffic/a89b8a27cb6b9148c5bf7f9dd4294c35 to your computer and use it in GitHub Desktop.
- name: "Set up authorized_keys for the root user"
hosts: pi
user: pi
tasks:
- name: Create new ssh key-pair
local_action: command ssh-keygen -t rsa -N "" -q -f ~/test/id_rsa
- name: Set up authorized_keys for the pi user
#authorized_key: user=pi key="{{ item }}" state=present exclusive=yes
authorized_key: user=pi key="{{ item }}" state=present exclusive=yes
with_file:
- ~/test/id_rsa.pub
- name: move key-pair
local_action: command mv ~/test/id_rsa ~/test/id_rsa.bak
run_once: true
- name: move key-pair
local_action: command mv ~/test/id_rsa.pub ~/test/id_rsa.pub.bak
run_once: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment