Ansible SSH best practices
The answer is Key Based SSH 

Reasons 


You can SSH multiple host machines using the same key or Different keys. 
If you reboot your machine while playbook running it again SSH using your provided key so your ansible-playbook runs without occurring any errors.
Also, you get authentication using the appropriate user.


use can use inventory.ini file 

example 

[hostMachine]
ubuntu@xx.xx.xx.xx  ansible_ssh_user=ubuntu ansible_ssh_private_key_file=/path of your pem file

[ABCDMachine]
ABCD@xx.xx.xx.xx ansible_ssh_user=ABCD ansible_ssh_private_key_file=/path of your pem file


Command for run ansible-playbook


  ansible-playbook -i inventory.ini main.yml