restart sshd if needed

This commit is contained in:
Pim Kunis 2023-04-26 19:12:10 +02:00
parent 96bc6e97c0
commit 65ea776c21
2 changed files with 8 additions and 0 deletions

4
handlers/main.yml Normal file
View file

@ -0,0 +1,4 @@
- name: restart sshd
systemd:
name: sshd
state: restarted

View file

@ -36,6 +36,7 @@
line: "CertificateFile /etc/ssh/{{ item.name }}-cert.pub"
create: true
when: item.type == "user"
notify: restart sshd
- name: Enable user identity
lineinfile:
@ -43,6 +44,7 @@
line: "IdentityFile /etc/ssh/{{ item.name }}"
create: true
when: item.type == "user"
notify: restart sshd
- name: Enable host certificate
lineinfile:
@ -50,6 +52,7 @@
line: "HostCertificate /etc/ssh/{{ item.name }}-cert.pub"
create: true
when: item.type == "host"
notify: restart sshd
- name: Enable host key
lineinfile:
@ -57,3 +60,4 @@
line: "HostKey /etc/ssh/{{ item.name }}"
create: true
when: item.type == "host"
notify: restart sshd