Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
- 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
You can’t perform that action at this time.