2012-10-30 16:22:20 -04:00
|
|
|
# == Class: etherpad_lite::apache
|
|
|
|
#
|
2012-08-04 13:10:26 -05:00
|
|
|
class etherpad_lite::apache (
|
2012-10-30 16:22:20 -04:00
|
|
|
$vhost_name = $::fqdn,
|
2015-03-13 12:17:35 -07:00
|
|
|
$docroot = '/srv/etherpad-lite',
|
2014-09-12 09:02:21 -07:00
|
|
|
$serveradmin = "webmaster@${::fqdn}",
|
2012-10-30 16:22:20 -04:00
|
|
|
$ssl_cert_file = '',
|
|
|
|
$ssl_key_file = '',
|
|
|
|
$ssl_chain_file = '',
|
|
|
|
$ssl_cert_file_contents = '', # If left empty puppet will not create file.
|
|
|
|
$ssl_key_file_contents = '', # If left empty puppet will not create file.
|
|
|
|
$ssl_chain_file_contents = '' # If left empty puppet will not create file.
|
2012-08-04 13:10:26 -05:00
|
|
|
) {
|
|
|
|
|
2012-10-21 09:35:17 -07:00
|
|
|
package { 'ssl-cert':
|
|
|
|
ensure => present,
|
|
|
|
}
|
|
|
|
|
2015-07-16 15:51:51 -04:00
|
|
|
include ::httpd
|
|
|
|
::httpd::vhost { $vhost_name:
|
2012-10-30 16:22:20 -04:00
|
|
|
port => 443,
|
2015-03-13 12:17:35 -07:00
|
|
|
docroot => $docroot,
|
2012-08-04 13:10:26 -05:00
|
|
|
priority => '50',
|
2012-08-12 10:47:51 -07:00
|
|
|
template => 'etherpad_lite/etherpadlite.vhost.erb',
|
2012-10-30 16:22:20 -04:00
|
|
|
ssl => true,
|
2012-08-04 13:10:26 -05:00
|
|
|
}
|
2015-07-09 16:29:16 -04:00
|
|
|
httpd_mod { 'rewrite':
|
2012-10-30 16:22:20 -04:00
|
|
|
ensure => present,
|
2012-08-04 13:10:26 -05:00
|
|
|
}
|
2015-07-09 16:29:16 -04:00
|
|
|
httpd_mod { 'proxy':
|
2012-10-30 16:22:20 -04:00
|
|
|
ensure => present,
|
2012-08-04 13:10:26 -05:00
|
|
|
}
|
2015-07-09 16:29:16 -04:00
|
|
|
httpd_mod { 'proxy_http':
|
2012-10-30 16:22:20 -04:00
|
|
|
ensure => present,
|
2012-08-04 13:10:26 -05:00
|
|
|
}
|
2015-01-30 14:47:54 +00:00
|
|
|
|
|
|
|
if ($::lsbdistcodename == 'precise') {
|
|
|
|
file { '/etc/apache2/conf.d/connection-tuning':
|
|
|
|
ensure => present,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
|
|
|
source => 'puppet:///modules/etherpad_lite/apache-connection-tuning',
|
|
|
|
notify => Service['httpd'],
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
file { '/etc/apache2/conf-available/connection-tuning':
|
|
|
|
ensure => present,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0644',
|
|
|
|
source => 'puppet:///modules/etherpad_lite/apache-connection-tuning',
|
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/apache2/conf-enabled/connection-tuning':
|
|
|
|
ensure => link,
|
|
|
|
target => '/etc/apache2/conf-available/connection-tuning',
|
|
|
|
notify => Service['httpd'],
|
|
|
|
require => File['/etc/apache2/conf-available/connection-tuning'],
|
|
|
|
}
|
2013-10-09 10:58:32 -07:00
|
|
|
}
|
2012-08-04 13:10:26 -05:00
|
|
|
|
2015-03-13 12:17:35 -07:00
|
|
|
file { $docroot:
|
|
|
|
ensure => directory,
|
|
|
|
}
|
|
|
|
|
|
|
|
file { "${docroot}/robots.txt":
|
|
|
|
ensure => present,
|
|
|
|
source => 'puppet:///modules/etherpad_lite/robots.txt',
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0444',
|
|
|
|
require => File[$docroot],
|
|
|
|
}
|
|
|
|
|
2012-08-04 13:10:26 -05:00
|
|
|
file { '/etc/ssl/certs':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'root',
|
2013-09-05 18:22:21 -07:00
|
|
|
mode => '0755',
|
2012-08-04 13:10:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/ssl/private':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'root',
|
2012-10-30 16:22:20 -04:00
|
|
|
mode => '0700',
|
2012-08-04 13:10:26 -05:00
|
|
|
}
|
|
|
|
|
2012-10-13 08:55:30 -07:00
|
|
|
if $ssl_cert_file_contents != '' {
|
|
|
|
file { $ssl_cert_file:
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0640',
|
|
|
|
content => $ssl_cert_file_contents,
|
2015-07-09 16:29:16 -04:00
|
|
|
before => Httpd::Vhost[$vhost_name],
|
2012-10-13 08:55:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if $ssl_key_file_contents != '' {
|
|
|
|
file { $ssl_key_file:
|
|
|
|
owner => 'root',
|
|
|
|
group => 'ssl-cert',
|
|
|
|
mode => '0640',
|
|
|
|
content => $ssl_key_file_contents,
|
|
|
|
require => Package['ssl-cert'],
|
2015-07-09 16:29:16 -04:00
|
|
|
before => Httpd::Vhost[$vhost_name],
|
2012-10-13 08:55:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if $ssl_chain_file_contents != '' {
|
|
|
|
file { $ssl_chain_file:
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0640',
|
|
|
|
content => $ssl_chain_file_contents,
|
2015-07-09 16:29:16 -04:00
|
|
|
before => Httpd::Vhost[$vhost_name],
|
2012-10-13 08:55:30 -07:00
|
|
|
}
|
|
|
|
}
|
2012-08-04 13:10:26 -05:00
|
|
|
}
|