aboutsummaryrefslogblamecommitdiff
path: root/modules/profile/manifests/postgresql.pp
blob: 97ce57291b6bbf4abf9de7c2e04932b5dbe04435 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12



                                          
                                                                






                                          





                                                             
                         




                                              

                                                                           

   
                                                       


 
class profile::postgresql (
  Optional[String] $pg_user  = "postgres",
  Optional[String] $pg_group = "postgres",
) {
  $password_seed = lookup("base_installation::puppet_pass_seed")

  class { '::postgresql::globals':
    encoding             => 'UTF-8',
    locale               => 'en_US.UTF-8',
    pg_hba_conf_defaults => false,
  }

  class { '::postgresql::client': }

  # FIXME: postgresql module is buggy and doesn't create dir?
  file { "/var/lib/postgres":
    ensure  => directory,
    owner   => $pg_user,
    group   => $pg_group,
    before  => File["/var/lib/postgres/data"],
    require => Package["postgresql-server"],
  }

  class { '::postgresql::server':
    postgres_password => generate_password(24, $password_seed, "postgres"),
    listen_addresses  => "*",
  }

  profile::postgresql::base_pg_hba_rules { "default": }

}