- name: Generate SSH key pairs openssh_keypair: path: "/etc/ssh/ssh_host_{{ item.type }}_key" type: "{{ item.type }}" force: yes when: vn_first_time loop: - { type: 'rsa' } - { type: 'ecdsa' } - { type: 'ed25519' } notify: restart sshd - name: Configure sshd_config settings copy: dest: /etc/ssh/sshd_config.d/vn-listenipv4.conf content: | # Do not edit this file! Ansible will overwrite it. ListenAddress 0.0.0.0 owner: root group: root mode: u=rw,g=r,o=r notify: restart sshd