I know you were just explaining how to do it but this is a simple task with Ansible.

- name: Ensure user exists user: name: Joe state: present password: "password_hash" groups: wheel, libvirt

Instead of needing the hash up front you can do things like:

{{ Password1234 | password_hash('sha512') }}