Ansible should be configured with ssh keys for secure authentication. But there are certain situations where we need to put password instead of configuring ssh keys.
Ansible playbook command accepts ssh password as parameter during execution.
#ansible-playbook -b -i inventories/hosts --limit hostgroup playbooks/rolename.yml --extra-vars "ansible_ssh_user=username ansible_ssh_pass=password"
Here we need to replace "inventories/hosts", "hostgroup", "playbooks/rolename.yml", "username" and "password" with the corresponding values.