[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