homeserver/roles/mgrote.deploy_ssh_keys/tasks/main.yml

23 lines
490 B
YAML
Raw Normal View History

2020-08-18 11:57:53 +02:00
---
- name: create .ssh directory
become: yes
file:
path: "/home/{{ ssh_user }}/.ssh"
state: directory
- name: touch file
become: yes
file:
path: "/home/{{ ssh_user }}/.ssh/authorized_keys"
state: touch
modification_time: preserve
access_time: preserve
- name: put pubkey
become: yes
lineinfile:
path: "/home/{{ ssh_user }}/.ssh/authorized_keys"
line: "{{ ssh_pubkey }}"
state: present
backup: yes