-update deploy_authorized_keys to make sure user "pi" exists
This commit is contained in:
@@ -1,15 +1,29 @@
|
|||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
tasks:
|
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
|
- name: make direcotry
|
||||||
|
become: true
|
||||||
file:
|
file:
|
||||||
path: "/home/pi/.ssh"
|
path: "/home/pi/.ssh"
|
||||||
|
owner: pi
|
||||||
|
group: pi
|
||||||
|
mode: '0700'
|
||||||
state: directory
|
state: directory
|
||||||
- name: create empty file
|
- name: create empty file
|
||||||
|
become: true
|
||||||
file:
|
file:
|
||||||
path: "/home/pi/.ssh/authorized_keys"
|
path: "/home/pi/.ssh/authorized_keys"
|
||||||
|
owner: pi
|
||||||
|
group: pi
|
||||||
|
mode: '0644'
|
||||||
state: touch
|
state: touch
|
||||||
- name: put pubkey
|
- name: put pubkey
|
||||||
|
become: true
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: "/home/pi/.ssh/authorized_keys"
|
path: "/home/pi/.ssh/authorized_keys"
|
||||||
line: "{{ pubkey }}"
|
line: "{{ pubkey }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user