Unable to generate a random password for a user account in Ansible playbook

Yes, check out lookup pipe.

There is also a lookup password that you might be able to use.