From 577c2d74d081bf9aa208452ecdcdc6146508ed2b Mon Sep 17 00:00:00 2001 From: David Galloway Date: Mon, 27 Nov 2017 14:03:08 -0500 Subject: [PATCH] cobbler: Regenerate SSH host keys on Ubuntu firstboot if necessary Signed-off-by: David Galloway --- roles/cobbler/templates/snippets/cephlab_rc_local | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roles/cobbler/templates/snippets/cephlab_rc_local b/roles/cobbler/templates/snippets/cephlab_rc_local index bc4a642..4bf384f 100644 --- a/roles/cobbler/templates/snippets/cephlab_rc_local +++ b/roles/cobbler/templates/snippets/cephlab_rc_local @@ -85,9 +85,16 @@ if [ -n "$myips" ]; then done fi -#end raw {% endif %} +# Regenerate SSH host keys on boot if needed +if command -v apt-get &>/dev/null; then + if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then + dpkg-reconfigure openssh-server + fi +fi +#end raw + # Only run once. if [ -e $lockfile ]; then exit 0 -- 2.39.5