Currently we are using pwgen to generate our random length passwords, but we would like to use an Ansible module to make things easier. What I have is not working -
Instead of range(8-12) I think you want range(8, 13). First you want a comma, and then range is non-inclusive of the last number, so you have to add 1.
The password lookup requires a file to write to, even if that is just /dev/null (a normal file is how it has historically achieved idempotency.