vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on "Patroni" and DCS "etcd" or "consul"). Automating with Ansible.
MIT License
1.27k stars 340 forks source link

pgbouncer: Сreate the 'user_search' function in pgbouncer_auth_dbname only #568

Closed SDV109 closed 2 months ago

SDV109 commented 2 months ago

This PR is to optimize adding the user_search function to {{pgbouncer_auth_dbname }} only and only once, if the given function already exists, the playbook will not perform the function creation step, when pgbouncer_auth_user is 'true'.

When pgbouncer_auth_user is 'false' a block will be used to create a userlist file. pgbouncer_auth_user is 'false'

When pgbouncer_auth_user is 'true', the playbook will use the block to create the user_search function in {{pgbouncer_auth_dbname }} only on the master server. image

When restarting the playbook, when the user_search function is already exists in {{pgbouncer_auth_dbname }}, there will only be a stage of checking for the existence of this function, there will be no repeat stage to add the function. image

vitabaks commented 2 months ago

Thanks @SDV109