Files
ansible/roles/common/tasks/sshd.yml
TuDatTr ef207c5d64 Added naruto
Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
2023-07-12 00:02:17 +02:00

24 lines
439 B
YAML

---
- name: Copy sshd_config
template:
src: templates/common/ssh/sshd_config
dest: /etc/ssh/sshd_config
mode: 0644
become: yes
register: sshd
- name: Copy pubkey
copy:
content: "{{ pubkey }}"
dest: "/home/{{ user }}/.ssh/authorized_keys"
owner: "{{ user }}"
group: "{{ user }}"
mode: "644"
- name: Restart sshd
service:
name: "sshd"
state: "restarted"
become: yes
when: sshd.changed