From 65ea776c21d9e207c904cf184aa1990f3958d8e3 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Wed, 26 Apr 2023 19:12:10 +0200 Subject: [PATCH] restart sshd if needed --- handlers/main.yml | 4 ++++ tasks/deploy_certificate.yml | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 handlers/main.yml diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..18c505e --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart sshd + systemd: + name: sshd + state: restarted diff --git a/tasks/deploy_certificate.yml b/tasks/deploy_certificate.yml index 0c7264c..cfae61f 100644 --- a/tasks/deploy_certificate.yml +++ b/tasks/deploy_certificate.yml @@ -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