mirror of
https://gitea.0xace.cc/ansible-galaxy/pgbouncer.git
synced 2025-06-29 03:03:07 +00:00
first commit
This commit is contained in:
48
templates/pgbouncer.ini.j2
Normal file
48
templates/pgbouncer.ini.j2
Normal file
@ -0,0 +1,48 @@
|
||||
[databases]
|
||||
{% for pool in pgbouncer_pools %}
|
||||
{{ pool.name }} = host={{ pool.host | default('127.0.0.1') }} port={{ pool.port | default('5432') }} dbname={{ pool.dbname }} {{ pool.pool_parameters }}
|
||||
{% endfor %}
|
||||
|
||||
* = host=127.0.0.1 port={{ pgbouncer_postgresql_port | default('5432') }}
|
||||
|
||||
[pgbouncer]
|
||||
{% if pgbouncer_client_tls_sslmode != 'disable' %}
|
||||
client_tls_sslmode = {{ pgbouncer_client_tls_sslmode }}
|
||||
client_tls_protocols = {{ pgbouncer_client_tls_protocols }}
|
||||
client_tls_ciphers = {{ pgbouncer_client_tls_ciphers }}
|
||||
client_tls_key_file = {{ pgbouncer_client_tls_key_file }}
|
||||
client_tls_cert_file = {{ pgbouncer_client_tls_cert_file }}
|
||||
{% endif %}
|
||||
{% if pgbouncer_server_tls_sslmode != 'disable' %}
|
||||
server_tls_sslmode = {{ pgbouncer_server_tls_sslmode }}
|
||||
{% endif %}
|
||||
logfile = {{ pgbouncer_log_dir }}/{{ pgbouncer_log_name }}
|
||||
pidfile = {{ pgbouncer_pid_dir }}/{{ pgbouncer_pid_name }}
|
||||
listen_addr = {{ hostvars[inventory_hostname]['inventory_hostname'] }}
|
||||
listen_port = {{ pgbouncer_listen_port | default(6432) }}
|
||||
unix_socket_dir = /var/run/postgresql
|
||||
auth_type = {{ pgbouncer_auth_type }}
|
||||
auth_file = {{ pgbouncer_auth_file }}
|
||||
{% if pgbouncer_auth_user is defined %}
|
||||
auth_user = {{ pgbouncer_auth_user }}
|
||||
{% endif %}
|
||||
{% if pgbouncer_auth_type == 'hba' %}
|
||||
auth_hba_file = {{ pgbouncer_auth_hba_file }}
|
||||
{% endif %}
|
||||
admin_users = {{ pgbouncer_admin_users }}
|
||||
ignore_startup_parameters = {{ pgbouncer_ignore_startup_parameters }}
|
||||
|
||||
pool_mode = {{ pgbouncer_default_pool_mode }}
|
||||
server_reset_query = DISCARD ALL
|
||||
max_client_conn = {{ pgbouncer_max_client_conn }}
|
||||
default_pool_size = {{ pgbouncer_default_pool_size }}
|
||||
reserve_pool_size = 1
|
||||
reserve_pool_timeout = 1
|
||||
max_db_connections = {{ pgbouncer_max_db_connections }}
|
||||
pkt_buf = 8192
|
||||
listen_backlog = 4096
|
||||
|
||||
log_connections = 0
|
||||
log_disconnections = 0
|
||||
|
||||
# Documentation https://pgbouncer.github.io/config.html
|
27
templates/pgbouncer.service.j2
Normal file
27
templates/pgbouncer.service.j2
Normal file
@ -0,0 +1,27 @@
|
||||
[Unit]
|
||||
Description=pgBouncer connection pooling for PostgreSQL
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
|
||||
User=postgres
|
||||
Group=postgres
|
||||
|
||||
PermissionsStartOnly=true
|
||||
ExecStartPre=-/bin/mkdir -p /var/run/pgbouncer {{ pgbouncer_log_dir }}
|
||||
ExecStartPre=/bin/chown -R postgres:postgres /var/run/pgbouncer {{ pgbouncer_log_dir }}
|
||||
{% if ansible_os_family == "Debian" %}
|
||||
ExecStart=/usr/sbin/pgbouncer -d {{ pgbouncer_conf_dir }}/pgbouncer.ini
|
||||
{% endif %}
|
||||
{% if ansible_os_family == "RedHat" %}
|
||||
ExecStart=/usr/bin/pgbouncer -d {{ pgbouncer_conf_dir }}/pgbouncer.ini
|
||||
{% endif %}
|
||||
ExecReload=/bin/kill -SIGHUP $MAINPID
|
||||
PIDFile=/var/run/pgbouncer/pgbouncer.pid
|
||||
Restart=on-failure
|
||||
|
||||
LimitNOFILE=100000
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
1
templates/userlist.txt.j2
Normal file
1
templates/userlist.txt.j2
Normal file
@ -0,0 +1 @@
|
||||
"{{ pgbouncer_postgresql_superuser_username }}" "{{ pgbouncer_postgresql_superuser_password_hash.query_result.0.passwd }}"
|
Reference in New Issue
Block a user