From: David Galloway Date: Mon, 27 Nov 2017 19:03:08 +0000 (-0500) Subject: cobbler: Regenerate SSH host keys on Ubuntu firstboot if necessary X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F346%2Fhead;p=ceph-cm-ansible.git cobbler: Regenerate SSH host keys on Ubuntu firstboot if necessary Signed-off-by: David Galloway --- diff --git a/roles/cobbler/templates/snippets/cephlab_rc_local b/roles/cobbler/templates/snippets/cephlab_rc_local index bc4a642a..4bf384f3 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