Puppet: Enable pgsql

This commit is contained in:
Eric Lippmann 2015-09-28 17:31:23 +02:00
parent df035ec0da
commit e20d791309
1 changed files with 10 additions and 11 deletions

View File

@ -1,7 +1,7 @@
# Class: pgsql # Class: pgsql
# #
# This class installs the postgresql server and client software. # This class installs the PostgreSQL server and client software.
# Further it configures pg_hba.conf to trus the local icinga user. # Further it configures pg_hba.conf to trust the local icinga user.
# #
# Parameters: # Parameters:
# #
@ -17,26 +17,25 @@ class pgsql {
Exec { path => '/sbin:/bin:/usr/bin' } Exec { path => '/sbin:/bin:/usr/bin' }
package { [ package { [ 'postgresql', 'postgresql-server', ]:
'postgresql', 'postgresql-server'
]:
ensure => latest, ensure => latest,
} }
exec { 'initdb': exec { 'initdb':
creates => '/var/lib/pgsql/data/pg_xlog',
command => 'service postgresql initdb', command => 'service postgresql initdb',
require => Package['postgresql-server'] creates => '/var/lib/pgsql/data/pg_xlog',
require => Package['postgresql-server'],
} }
service { 'postgresql': service { 'postgresql':
enable => true,
ensure => running, ensure => running,
require => [Package['postgresql-server'], Exec['initdb']] require => [ Package['postgresql-server'], Exec['initdb'], ]
} }
file { '/var/lib/pgsql/data/pg_hba.conf': file { '/var/lib/pgsql/data/pg_hba.conf':
content => template('pgsql/pg_hba.conf.erb'), content => template('pgsql/pg_hba.conf.erb'),
require => [Package['postgresql-server'], Exec['initdb']], require => [ Package['postgresql-server'], Exec['initdb'], ],
notify => Service['postgresql'] notify => Service['postgresql'],
} }
} }