From a5c894a7f42bc6ea29b9e740146eb424c6899215 Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 8 Mar 2018 18:48:33 +0100 Subject: [PATCH] Generate new ed25519 host key if necessary --- tasks/main.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tasks/main.yml b/tasks/main.yml index 24202f5..d354cbf 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -7,6 +7,17 @@ group: root mode: 'u=rw,g=r,o=r' validate: /usr/sbin/sshd -t -f %s + notify: + - restart ssh + + +- name: Generate new ed25519 ssh host key pair if necessary + command: ssh-keygen -t ed25519 -f 'ssh_host_ed25519_key' -P '' -q + args: + chdir: '/etc/ssh/' + creates: 'ssh_host_ed25519_key.pub' + notify: + - restart ssh - name: Remove unwanted host keys @@ -17,6 +28,8 @@ - ecdsa - rsa - dsa + notify: + - restart ssh - file: path: '/etc/ssh/ssh_host_{{ item }}_key.pub' state: absent @@ -24,3 +37,5 @@ - ecdsa - rsa - dsa + notify: + - restart ssh