Sha256: 629abde106d3a437081942d03a62e598070fa4c76e7c4c121418848349844170

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

# Define for conveniently creating a role, database and assigning the correct
# permissions. See README.md for more details.
define postgresql::server::db (
  $user,
  $password,
  $encoding   = $postgresql::server::encoding,
  $locale     = $postgresql::server::locale,
  $grant      = 'ALL',
  $tablespace = undef,
  $template   = 'template0',
  $istemplate = false,
  $owner      = undef
) {
  postgresql::server::database { $name:
    encoding   => $encoding,
    tablespace => $tablespace,
    template   => $template,
    locale     => $locale,
    istemplate => $istemplate,
    owner      => $owner,
  }

  if ! defined(Postgresql::Server::Role[$user]) {
    postgresql::server::role { $user:
      password_hash => $password,
    }
  }

  postgresql::server::database_grant { "GRANT ${user} - ${grant} - ${name}":
    privilege => $grant,
    db        => $name,
    role      => $user,
  }

  if($tablespace != undef and defined(Postgresql::Server::Tablespace[$tablespace])) {
    Postgresql::Server::Tablespace[$tablespace]->Postgresql::Server::Database[$name]
  }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
freighthop-0.6.1 modules/postgresql/manifests/server/db.pp
freighthop-0.6.0 modules/postgresql/manifests/server/db.pp
freighthop-0.5.2 modules/postgresql/manifests/server/db.pp
freighthop-0.5.1 modules/postgresql/manifests/server/db.pp
freighthop-0.5.0 modules/postgresql/manifests/server/db.pp
freighthop-0.4.1 modules/postgresql/manifests/server/db.pp
freighthop-0.4.0 modules/postgresql/manifests/server/db.pp