--- - name: Install pgbouncer apt: name: pgbouncer - name: Remove pgbouncer from init.d (may conflict with systemd service) file: path: /etc/init.d/pgbouncer state: absent when: is_docker - name: Update rc.d to reflect init.d removal command: cmd: update-rc.d pgbouncer remove when: is_docker - name: Add pgbouncer.ini template: src: pgbouncer.ini.jinja2 dest: /etc/pgbouncer/pgbouncer.ini owner: postgres group: postgres mode: 0640 notify: - Reload pgbouncer - name: Add user to pgbouncer userlist lineinfile: path: /etc/pgbouncer/userlist.txt line: '"tildes" ""' create: true owner: postgres group: postgres mode: 0640 notify: - Reload pgbouncer - name: Start and enable pgbouncer service systemd_service: name: pgbouncer state: started enabled: true