You can checkout MVladislav - ansible-env-setup - playbooks for how i use it in general.
Tested with:
- Ubuntu 23.04
clients:
- name: "{{ ansible_user }}"
ssh_only_client_setup: false
Developed and testes with Ansible 2.14.4
- hosts: servers
roles:
- role: ansible-ssh
clients:
- name: "{{ ansible_user }}"
ssh_only_client_setup: false
MIT
sed -i '/KeyRegenerationInterval/d' /etc/ssh/sshd_config
sed -i '/ServerKeyBits/d' /etc/ssh/sshd_config
sed -i '/RSAAuthentication/d' /etc/ssh/sshd_config
sed -i '/RhostsRSAAuthentication/d' /etc/ssh/sshd_config
sed -i '/UsePrivilegeSeparation/d' /etc/ssh/sshd_config