From: David Galloway Date: Mon, 27 Nov 2017 18:42:31 +0000 (-0500) Subject: tools: Delete ssh keys so FOG-imaged machines regenerate on firstboot X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F353%2Fhead;p=ceph-cm-ansible.git tools: Delete ssh keys so FOG-imaged machines regenerate on firstboot Signed-off-by: David Galloway --- diff --git a/tools/prep-fog-capture.yml b/tools/prep-fog-capture.yml index ddb7f184..416cce7f 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