puppet-aegir/manifests/hostmaster.pp

82 lines
2.6 KiB
ObjectPascal
Raw Normal View History

2016-11-30 21:31:23 +00:00
# Installs a hostmaster on a debian system using the available repos.
# This module should be called from a profile where the other major software
# eg, webserver and db server are decided on.
class aegir::hostmaster (
# A hash with 'user', 'host', 'password'. Currently only mysql is supported by
# aegir.
$database,
$frontend_url = $::fqdn,
$version = 3,
$user = 'aegir', # Unused
$home = '/var/aegir', # Unused
# The webserver, apache2 or nginx.
$server = 'apache2',
# Commonly available releases: stable, unstable.
$release = 'stable',
$makefile = '',
$email = '',
$working_copy = false,
$drush_version = ''
) {
include apt
include stdlib
2016-11-30 21:31:23 +00:00
apt::source { 'aegir':
location => 'http://debian.aegirproject.org',
release => $release,
key => {
id => '12782E2257B468806EF36D165ADF93A03376CCF9',
source => 'http://debian.aegirproject.org/key.asc',
},
repos => 'main'
}
$package_name = "aegir${version}"
$debconf_settings = [
"${package_name}-hostmaster aegir/site string ${frontend_url}",
"${package_name}-hostmaster aegir/db_password string ${database['password']}",
"${package_name}-hostmaster aegir/db_host string ${database['host']}",
"${package_name}-hostmaster aegir/db_user string ${database['user']}",
"${package_name}-hostmaster aegir/webserver select ${server}",
2016-11-30 21:31:23 +00:00
]
if $email {
concat($debconf_settings, ["${package_name}-hostmaster aegir/email string ${email}"])
2016-11-30 21:31:23 +00:00
}
if $makefile {
concat($debconf_settings, ["${package_name}-hostmaster aegir/makefile string ${makefile}"])
2016-11-30 21:31:23 +00:00
}
if $working_copy {
concat($debconf_settings, ["${package_name}-hostmaster aegir/working-copy boolean true"])
2016-11-30 21:31:23 +00:00
}
if $drush_version {
concat($debconf_settings, ["${package_name}-provision aegir/drush_version string ${drush_version}"])
2016-11-30 21:31:23 +00:00
}
file { '/etc/dpkg/aegir.response':
ensure => 'file',
content => join($debconf_settings, "\n")
}
if ($server == 'nginx') {
# Install nginx and phpX-fpm before running the aegir install.
$nginx_packages = ['nginx']
case $facts['os']['lsb']['distcodename'] {
'wheezy', 'jessie': { concat($nginx_packages, ['php5-fpm']) }
default: { concat($nginx_packages, ['php7.0-fpm']) }
}
ensure_packages(
$nginx_packages,
{
'ensure' => 'present',
'before' => Package['aegir'],
}
)
}
2016-11-30 21:31:23 +00:00
package { 'aegir':
ensure => 'installed',
name => $package_name,
responsefile => '/etc/dpkg/aegir.response',
require => [
Apt::Source['aegir'],
Class['apt::update'],
File['/etc/dpkg/aegir.response']
]
}
}