---
- block:

  - name: Configure ssh server
    command: dpkg-reconfigure --frontend noninteractive openssh-server

  # The ssh host keys are installed in the customization partition
  - name: Remove ssh server keys
    file:
      path: "{{ item }}"
      state: absent
    loop:
      - /etc/ssh/ssh_host_rsa_key
      - /etc/ssh/ssh_host_dsa_key
      - /etc/ssh/ssh_host_ecdsa_key
      - /etc/ssh/ssh_host_ed25519_key
      - /etc/ssh/ssh_host_rsa_key.pub
      - /etc/ssh/ssh_host_dsa_key.pub
      - /etc/ssh/ssh_host_ecdsa_key.pub
      - /etc/ssh/ssh_host_ed25519_key.pub

  become: yes
