diff --git a/manifests/apache.pp b/manifests/apache.pp index 7fe10d6..effaaab 100644 --- a/manifests/apache.pp +++ b/manifests/apache.pp @@ -2,6 +2,7 @@ # class etherpad_lite::apache ( $vhost_name = $::fqdn, + $docroot = '/srv/etherpad-lite', $serveradmin = "webmaster@${::fqdn}", $ssl_cert_file = '', $ssl_key_file = '', @@ -18,7 +19,7 @@ class etherpad_lite::apache ( include apache apache::vhost { $vhost_name: port => 443, - docroot => 'MEANINGLESS ARGUMENT', + docroot => $docroot, priority => '50', template => 'etherpad_lite/etherpadlite.vhost.erb', ssl => true, @@ -59,6 +60,19 @@ class etherpad_lite::apache ( } } + 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], + } + file { '/etc/ssl/certs': ensure => directory, owner => 'root', diff --git a/manifests/site.pp b/manifests/site.pp index 6dc3e11..fffff00 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -39,15 +39,6 @@ class etherpad_lite::site ( require => Class['etherpad_lite'], } - file { "${base}/etherpad-lite/src/static/robots.txt": - ensure => present, - source => 'puppet:///modules/etherpad_lite/robots.txt', - owner => $etherpad_lite::ep_user, - group => $etherpad_lite::ep_user, - mode => '0644', - require => Class['etherpad_lite'], - } - include logrotate logrotate::file { 'epliteerror': log => "${base}/${etherpad_lite::ep_user}/error.log", diff --git a/templates/etherpadlite.vhost.erb b/templates/etherpadlite.vhost.erb index e6711bb..5185362 100644 --- a/templates/etherpadlite.vhost.erb +++ b/templates/etherpadlite.vhost.erb @@ -47,6 +47,10 @@ RewriteCond %{HTTP_HOST} !<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> RewriteRule ^.*$ https://<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> [L,R=301] + # Server robots.txt directly so that it does not affect + # etherpad-lite installation. + RewriteRule ^/robots.txt$ <%= scope.lookupvar("etherpad_lite::apache::docroot") %>/robots.txt [L] + RewriteCond %{REQUEST_URI} !^/p/ RewriteCond %{REQUEST_URI} !^/locales/ RewriteCond %{REQUEST_URI} !^/locales.json