# Puppet Class: confdroid_postgresql::bouncer::bouncer

Inherits:
  confdroid_postgresql::params

Defined in:
  manifests/bouncer/bouncer.pp

## Summary

Class manages the pgbouncer service

## Overview

confdroid_postgresql::bouncer::bouncer.pp Module name: confdroid_postgresql Author: 12ww1160 (12ww1160@confdroid.com) }

Examples:

confdroid_postgresql::bouncer::bouncer_rule { ‘test connection’:

    pl_bouncer_db_name    => 'test',
    pl_bouncer_host       => '127.0.0.7',
    pl_bouncer_host_port  => '5432',
    pl_bouncer_user       => 'test_user',
    pl_bouncer_order      => '001',

    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56

    # File 'manifests/bouncer/bouncer.pp', line 13

    class confdroid_postgresql::bouncer::bouncer (

    ) inherits confdroid_postgresql::params {
      if ($fqdn == $pl_server_fqdn) and ($pl_use_pg_bouncer == true) {
        # ensure directory exists
        file { $pl_bouncer_dir:
          ensure   => directory,
          owner    => 'root',
          group    => 'root',
          mode     => '0750',
          selrange => s0,
          selrole  => object_r,
          seltype  => etc_t,
          seluser  => system_u,
        }
        # create auth user file to be populated through placeholder
        file { $pl_bouncer_auth_file:
          ensure   => file,
          owner    => 'pgbouncer',
          group    => 'pgbouncer',
          mode     => '0440',
          selrange => s0,
          selrole  => object_r,
          seltype  => etc_t,
          seluser  => system_u,
          content  => template($pl_bouncer_auth_erb),
        }

        # create the pgbouncer.ini file
        concat { $pl_bouncer_ini_file:
          ensure => present,
          owner  => 'pgbouncer',
          mode   => '0600',
          #notify => Service[$pl_service],
        }

        # manage file header
        concat::fragment { 'bouncer_header':
          target  => $pl_bouncer_ini_file,
          content => template($pl_bouncer_ini_erb),
          order   => '000',
        }
      }
    }