ansible/roles/common/tasks/sshd.yml

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