Puppet Class: postgresql::pgbouncer::config

Inherits:
postgresql::pgbouncer
Defined in:
manifests/pgbouncer/config.pp

Overview



1
2
3
4
5
6
7
8
9
10
11
12
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'manifests/pgbouncer/config.pp', line 1

class postgresql::pgbouncer::config inherits postgresql::pgbouncer {

  concat { '/etc/pgbouncer/pgbouncer.ini':
    ensure => 'present',
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
  }

  concat::fragment{ 'base pgbouncer':
    order   => '00',
    target  => '/etc/pgbouncer/pgbouncer.ini',
    content => template("${module_name}/pgbouncer/pgbouncer.erb"),
  }

  concat { '/etc/pgbouncer/pgbouncer-databases.ini':
    ensure => 'present',
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
  }

  concat::fragment{ 'base pgbouncer databases':
    order   => '00',
    target  => '/etc/pgbouncer/pgbouncer-databases.ini',
    content => template("${module_name}/pgbouncer/databases-header.erb"),
  }

  concat { '/etc/pgbouncer/userlist.txt':
    ensure => 'present',
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
  }

  if($postgresql::pgbouncer::realize_dbs_tag!=undef)
  {
    Postgresql::Pgbouncer::Database <| tag == $postgresql::pgbouncer::realize_dbs_tag |>
  }

  if($postgresql::pgbouncer::realize_users_tag!=undef)
  {
    Postgresql::Pgbouncer::Username <| tag == $postgresql::pgbouncer::realize_dbs_tag |>
  }

  if($postgresql::pgbouncer::set_pgbouncer_password!=undef)
  {
    postgresql::role { 'pgbouncer':
      password => $postgresql::pgbouncer::set_pgbouncer_password,
      db_host  => $postgresql::pgbouncer::dbhost_pgbouncer,
    }

    $password_hash_md5=md5("${postgresql::pgbouncer::set_pgbouncer_password}pgbouncer")
    $password_hash_sql="md5${password_hash_md5}"

    postgresql::pgbouncer::username { 'pgbouncer':
      password_md5 => $password_hash_sql,
    }

    postgresql::hba_rule { 'pgbouncer':
  		user     => 'pgbouncer',
      database => 'all',
  		address  => "${postgresql::pgbouncer::src_ip_pgbouncer}/32",
  	}

    #user_authentication-sql.erb
    file { '/etc/pgbouncer/.user_authentication.sql':
      ensure  => 'present',
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => template("${module_name}/pgbouncer/user_authentication-sql.erb"),
    }
  }
}