# Posgresql\_user not working properly

**URL:** <https://forum.ansible.com/t/posgresql-user-not-working-properly/8146>\
**Category:** Get Help\
**Created:** [August 28, 2024, 6:34pm UTC](https://forum.ansible.com/t/posgresql-user-not-working-properly/8146 "2024-08-28T18:34:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpadair](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bpadair/32/317_2.png) [@bpadair](https://forum.ansible.com/u/bpadair)\
**Post date:** [August 28, 2024, 6:34pm UTC](https://forum.ansible.com/t/posgresql-user-not-working-properly/8146/1 "2024-08-28T18:34:55Z")

</div>

I am trying to use community.postgresql.postgresql\_user to create a user on a brand new database. This fails with an error that just says “MODULE FAILURE se stdout/stderr for the exact error”. When I output stdout/stderr, they say “VARIABLE IS NOT DEFINED!”. The task I am running is:

```auto
 - name: Config | Create dba user
    become: true
    become_user: postgres
    community.postgresql.postgresql_user:
      name: dba
      state: present
      password: "{{ db_password }}"
      role_attr_flags: CREATEDB,SUPERUSER,CREATEROLE
    register: createuser
    environment:
      PGOPTION: "-c password_encryption=scram-sha-256"

```

However, even when I remove the only line that has a variable in it, it fails with the same error. I am kind of at a loss with this one. If anyone has any ideas, I would greatly appreciate it.
