fa24f24397
This commit creates a new class called `package_source_info`, which has some initial framework for managing the postgresql.org yumrepo. It also serves as a container for the 'version' variable that is needed by the 'platform' class in order to use other versions of postgres besides the system default.
51 lines
No EOL
1.6 KiB
Puppet
51 lines
No EOL
1.6 KiB
Puppet
# TODO: add real docs
|
|
|
|
# This class allows you to use a newer version of postgres, rather than your
|
|
# system's default version.
|
|
#
|
|
# Note that it is important that you use the '->', or a
|
|
# before/require metaparameter to make sure that the `package_source_info`
|
|
# class is evaluated before any of the other classes in the module.
|
|
#
|
|
# Also note that this class includes the ability to automatically manage
|
|
# the yumrepo resource. If you'd prefer to manage the repo yourself, simply pass
|
|
# 'false' or omit the 'manage_repo' parameter--it defaults to 'false'. You will
|
|
# still need to use the 'package_source_info' class to specify the postgres version
|
|
# number, though, in order for the other classes to be able to find the
|
|
# correct paths to the postgres dirs.
|
|
|
|
class postgresql::package_source_info(
|
|
$version,
|
|
$manage_repo = false,
|
|
$source = ''
|
|
) {
|
|
|
|
if ($manage_repo) {
|
|
case $::osfamily {
|
|
'RedHat': {
|
|
if ! $source {
|
|
$pkg_source = 'yum.postgresql.org'
|
|
} else {
|
|
$pkg_source = $source
|
|
}
|
|
|
|
case $pkg_source {
|
|
'yum.postgresql.org': {
|
|
class { "postgresql::package_source::yum_postgresql_org":
|
|
version => $version
|
|
}
|
|
}
|
|
|
|
default: {
|
|
fail("Unsupported package source '${pkg_source}' for ${::osfamily} OS family. Currently the only supported source is 'yum.postgresql.org'")
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
default: {
|
|
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports osfamily RedHat and Debian")
|
|
}
|
|
}
|
|
}
|
|
} |