Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgbouncer user doesn't exist error when trying to deploy from command line #795

Open
biglolka opened this issue Oct 22, 2024 · 7 comments
Open
Assignees

Comments

@biglolka
Copy link

biglolka commented Oct 22, 2024

Hello @vitabaks,

I'm trying to deploy the cluster with the ansible script, but I keep getting the following error:

`fatal: [172.22.134.241]: FAILED! => {"changed": true, "cmd": ["/usr/lib/postgresql/16/bin/psql", "-p", "5432", "-U", "postgres", "-d", "postgres", "-tAXc", "CREATE FUNCTION user_search(uname TEXT) RETURNS TABLE (usename name, passwd text) AS $$ SELECT usename, passwd FROM pg_shadow WHERE usename=$1; $$ LANGUAGE sql SECURITY DEFINER; REVOKE ALL ON FUNCTION user_search(uname TEXT) FROM public; GRANT EXECUTE ON FUNCTION user_search(uname TEXT) TO pgbouncer"], "delta": "0:00:00.011840", "end": "2024-10-22 13:16:06.143323", "msg": "non-zero return code", "rc": 1, "start": "2024-10-22 13:16:06.131483", "stderr": "ERROR:  role \"pgbouncer\" does not exist", "stderr_lines": ["ERROR:  role \"pgbouncer\" does not exist"], "stdout": "CREATE FUNCTION\nREVOKE", "stdout_lines": ["CREATE FUNCTION", "REVOKE"]}`

Thanks in advance for your response!

@vitabaks
Copy link
Owner

Hi @biglolka

Which version of postgresql_cluster are you using?

Make sure that you have a pgbouncer user defined in the postgresql_users variable as here https://github.com/vitabaks/postgresql_cluster/blob/2.0.0/automation/vars/main.yml#L186

@biglolka
Copy link
Author

biglolka commented Oct 22, 2024

Hi @vitabaks,

Thanks for the heads-up, you diverted my attention to the right direction:
According to the comment the password for the user will be generated if not defined explicitly in the yaml:

pgbouncer_auth_password: "" # If not defined, a password will be generated automatically during deployment

In fact that caused the problem, when setting the password in the yaml for "pgbouncer"user it works OK.

@vitabaks
Copy link
Owner

there should be no problem for automatic password generation if pgbouncer_auth_password is not set, what error did you get?

@biglolka
Copy link
Author

If I don't set pgbouncer password (but postgres and replicator) in main.yaml I get this error at this stage:
image
If I don't set postgres user password in main.yaml it fails at this stage:
image
If I set postgres password in main.yaml but I don't set replicator password it's hanging here:
image
so for sure generating the passwords in case they are not explicitly set in the main.yaml doesn't work.

@vitabaks
Copy link
Owner

vitabaks commented Oct 23, 2024

At the same time, did you have the postgresql_users variable filled in? Could you attach the full Ansible log?

if I understood correctly, the problem with the password for pgbouncer (lack of autogeneration) is possible if the password for pgbouncer_auth_password is not set, but at the same time set it for patroni_superuser_password.

I'll check it out.

@vitabaks vitabaks self-assigned this Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@vitabaks @biglolka and others