geerlingguy / ansible-role-postgresql

Ansible Role - PostgreSQL
https://galaxy.ansible.com/geerlingguy/postgresql/
MIT License
572 stars 389 forks source link

I am not able to create users and databases #227

Closed reeshabhranjan closed 1 year ago

reeshabhranjan commented 2 years ago

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: psycopg2.OperationalError: connection to server at "127.0.0.1", port 5432 failed: fe_sendauth: no password supplied

- hosts: all
  roles:
    - role: geerlingguy.postgresql
      become: yes
      vars:
        postgresql_databases:
          - name: db1
            login_host: 127.0.0.1
            owner: user1
        postgresql_users:
          - name: user1
            password: password1
...
stale[bot] commented 1 year ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

robinportigliatti commented 1 year ago

Hello,

This error means that you didn't supply a password when you tried to connect to the database.

In fact here you try to connect remotely and not locally using 127.0.0.1. This is a misconception between localhost and 127.0.0.1.

Since you try to connect remotely you will end up here when postgresql will try to accept your host based authentication: https://github.com/geerlingguy/ansible-role-postgresql/blob/master/defaults/main.yml#L34

You should try removing login_host since the default value to connect to your database will be localhost and you might find yourself with a different error.

Robin,

stale[bot] commented 1 year ago

This issue is no longer marked for closure.

stale[bot] commented 1 year ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

github-actions[bot] commented 1 year ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.