puppet-alternc/manifests/bureau.pp

91 lines
2.3 KiB
Puppet

class alternc::bureau (
String $database_password,
String $database_mail_password,
String $panel_title = 'AlternC',
String $panel_hostname = $facts['fqdn'],
String $panel_internal_ip = $facts['ipaddress'],
String $panel_public_ip = $facts['ipaddress'],
Boolean $panel_use_private_ip = true,
String $mail_directory = '/var/mail/alternc',
String $html_directory = '/var/www/alternc',
String $logs_directory = '/var/log/alternc/sites',
Array[String] $nameservers = [
$facts['hostname']
],
Array[String] $mx = [
$facts['hostname']
],
String $database_host = 'localhost',
String $database_name = 'alternc',
String $database_user = 'alternc',
String $database_mail_user = 'alternc_user',
Boolean $database_is_local = true,
Boolean $manage_sources = true,
) {
$ns_primary = $nameservers[0]
if $nameservers[1] == undef {
$ns_secondary = $ns_primary
}
else {
$ns_secondary = $nameservers[1]
}
$mx_primary = $mx[0]
if $mx[1] == undef {
$mx_secondary = ''
}
else {
$mx_secondary = $mx[1]
}
file { '/etc/dpkg/alternc.response':
ensure => present,
content => template('alternc/alternc.response.erb'),
}
if ($manage_sources) {
# Upstream hasn't released anything into the stretch archives
# or later. 2018.06.08
if ($facts['os']['lsb']['majdistrelease'] >= '8') {
$release = 'jessie'
}
else {
$release = $facts['os']['lsb']['distcodename']
}
apt::source { 'alternc':
location => 'http://debian.alternc.org',
release => $release,
key => {
id => '54E9B3EC75A6375C4670104BA4AFB8B58971F6F2',
source => 'https://debian.alternc.org/key.txt',
},
repos => 'main',
}
Apt::Source['alternc']
-> Package['alternc']
Apt::Source['alternc']
~> Class[Apt::Update]
}
package { 'acl':
ensure => present,
}
package { 'alternc':
ensure => present,
responsefile => '/etc/dpkg/alternc.response',
require => Package['acl'],
}
exec { 'alternc.install':
command => '/usr/sbin/alternc.install',
refreshonly => true,
}
exec { 'alternc.restartapache':
command => '/usr/sbin/service apache2 restart',
refreshonly => true,
}
File['/etc/dpkg/alternc.response']
-> Package['alternc']
~> Exec['alternc.install']
~> Exec['alternc.restartapache']
}