Files
FOSSBilling/puphpet/puppet/modules/postgresql/manifests/server/install.pp
T
Vaidas Lungis 88512e863b add vagrant puphpet configuration
OS - Ubuntu 12.04
PHP - 5.4 with cli intl mcrypt curl gd imagick mbstring MySQL
IP - 10.20.30.12
target folder - /var/www/boxbilling
servername - boxbilling.test
XDEBUG
2014-12-11 12:42:50 +02:00

50 lines
1.8 KiB
Puppet

# PRIVATE CLASS: do not call directly
class postgresql::server::install {
$package_ensure = $postgresql::server::package_ensure
$package_name = $postgresql::server::package_name
$client_package_name = $postgresql::server::client_package_name
# This is necessary to ensure that the extra client package that was
# installed automatically by the server package is removed and all
# of its dependencies are removed also. Without this later installation
# of the native Ubuntu packages will fail.
if($::operatingsystem == 'Ubuntu' and $package_ensure == 'absent') {
# This is an exec, because we want to invoke autoremove.
#
# An alternative would be to have a full list of packages, but that seemed
# more problematic to maintain, not to mention the conflict with the
# client class will create duplicate resources.
exec { 'apt-get-autoremove-postgresql-client-XX':
command => "apt-get autoremove --purge --yes ${client_package_name}",
onlyif => "dpkg -l ${client_package_name} | grep -e '^ii'",
logoutput => on_failure,
path => '/usr/bin:/bin:/usr/sbin/:/sbin',
}
# This will clean up anything we miss
exec { 'apt-get-autoremove-postgresql-client-brute':
command => "dpkg -P postgresql*",
onlyif => "dpkg -l postgresql* | grep -e '^ii'",
logoutput => on_failure,
path => '/usr/bin:/bin:/usr/sbin/:/sbin',
}
}
$_package_ensure = $package_ensure ? {
true => 'present',
false => 'purged',
'absent' => 'purged',
default => $package_ensure,
}
package { 'postgresql-server':
ensure => $_package_ensure,
name => $package_name,
# This is searched for to create relationships with the package repos, be
# careful about its removal
tag => 'postgresql',
}
}