Sha256: 94b658f5a91e8769ae81b837e37a2dd659af1d47afbc620ebcc07adbd7e381d1

Contents?: true

Size: 1020 Bytes

Versions: 7

Compression:

Stored size: 1020 Bytes

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,
  $istemplate = false,
  $owner      = undef
) {
  postgresql::server::database { $name:
    encoding   => $encoding,
    tablespace => $tablespace,
    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.3.3 modules/postgresql/manifests/server/db.pp
freighthop-0.3.2 modules/postgresql/manifests/server/db.pp
freighthop-0.3.1 modules/postgresql/manifests/server/db.pp
freighthop-0.3.0 modules/postgresql/manifests/server/db.pp
freighthop-0.2.1 modules/postgresql/manifests/server/db.pp
freighthop-0.2.0 modules/postgresql/manifests/server/db.pp
freighthop-0.1.0 modules/postgresql/manifests/server/db.pp