90 lines
2.9 KiB
Puppet
90 lines
2.9 KiB
Puppet
# 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
|
|
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}",
|
|
]
|
|
if $email {
|
|
concat($debconf_settings, ["${package_name}-hostmaster aegir/email string ${email}"])
|
|
}
|
|
if $makefile {
|
|
concat($debconf_settings, ["${package_name}-hostmaster aegir/makefile string ${makefile}"])
|
|
}
|
|
if $working_copy {
|
|
concat($debconf_settings, ["${package_name}-hostmaster aegir/working-copy boolean true"])
|
|
}
|
|
if $drush_version {
|
|
concat($debconf_settings, ["${package_name}-provision aegir/drush_version string ${drush_version}"])
|
|
}
|
|
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'],
|
|
}
|
|
)
|
|
$install_options = join($nginx_packages)
|
|
}
|
|
else {
|
|
$install_options = ''
|
|
}
|
|
# Pass in extra packages through install options for nginx support.
|
|
# Even with aegir/webserver set in preconfig, apt-get tries to install
|
|
# with phpX (not fpm).
|
|
package { 'aegir':
|
|
ensure => 'installed',
|
|
name => $package_name,
|
|
responsefile => '/etc/dpkg/aegir.response',
|
|
install_options => $install_options,
|
|
require => [
|
|
Apt::Source['aegir'],
|
|
Class['apt::update'],
|
|
File['/etc/dpkg/aegir.response']
|
|
]
|
|
}
|
|
}
|