-update deploy_authorized_keys to make sure user "pi" exists

This commit is contained in:
Michael Pellegrino
2022-05-06 19:48:36 +00:00
parent 5b4528b2bb
commit fc0b355f1d

View File

@@ -1,15 +1,29 @@
---
- hosts: all
tasks:
- name: make sure user pi exists
become: true
ansible.builtin.user:
name: pi
groups: adm,cdrom,dip,plugdev,lxd,users,sudo
- name: make direcotry
become: true
file:
path: "/home/pi/.ssh"
owner: pi
group: pi
mode: '0700'
state: directory
- name: create empty file
become: true
file:
path: "/home/pi/.ssh/authorized_keys"
owner: pi
group: pi
mode: '0644'
state: touch
- name: put pubkey
become: true
lineinfile:
path: "/home/pi/.ssh/authorized_keys"
line: "{{ pubkey }}"