Files
dsfin-ansible/deploy_authorized_keys.yml
2022-05-06 19:48:36 +00:00

30 lines
618 B
YAML

---
- 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 }}"