From 77dbbfe59686bca4b2e46653d136e5461b52cc6f Mon Sep 17 00:00:00 2001 From: David Galloway Date: Mon, 27 Nov 2017 13:42:31 -0500 Subject: [PATCH] tools: Delete ssh keys so FOG-imaged machines regenerate on firstboot Signed-off-by: David Galloway --- tools/prep-fog-capture.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/prep-fog-capture.yml b/tools/prep-fog-capture.yml index ddb7f18..416cce7 100644 --- a/tools/prep-fog-capture.yml +++ b/tools/prep-fog-capture.yml @@ -41,3 +41,17 @@ mount: path: /var/lib/ceph state: unmounted + + - name: Get list of SSH host keys + shell: "ls -1 /etc/ssh/ssh_host_*" + register: ssh_host_keys + ignore_errors: true + + # Key regeneration is done automatically on CentOS firstboot. + # For Ubuntu, we'll add `dpkg-reconfigure openssh-server` to rc.local + - name: Delete SSH host keys so they're generated during firstboot on cloned machines + file: + path: "{{ item }}" + state: absent + with_items: "{{ ssh_host_keys.stdout_lines|default([]) }}" + when: ssh_host_keys is defined -- 2.39.5