Manage apache vhost
This commit is contained in:
parent
dca2b08678
commit
fcceebcfcf
4 changed files with 83 additions and 9 deletions
|
@ -1,7 +1,8 @@
|
||||||
fixtures:
|
fixtures:
|
||||||
repositories:
|
repositories:
|
||||||
stdlib: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
|
apache: 'git://github.com/puppetlabs/puppetlabs-apache.git'
|
||||||
vcsrepo: 'git://github.com/puppetlabs/puppetlabs-vcsrepo.git'
|
stdlib: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
|
||||||
|
vcsrepo: 'git://github.com/puppetlabs/puppetlabs-vcsrepo.git'
|
||||||
|
|
||||||
symlinks:
|
symlinks:
|
||||||
icingaweb2: "#{source_dir}"
|
icingaweb2: "#{source_dir}"
|
||||||
|
|
|
@ -54,5 +54,11 @@ class icingaweb2::config {
|
||||||
ensure => directory,
|
ensure => directory,
|
||||||
mode => $::icingaweb2::config_dir_mode;
|
mode => $::icingaweb2::config_dir_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $::icingaweb2::manage_apache_vhost {
|
||||||
|
::apache::custom_config { 'icingaweb2':
|
||||||
|
content => template('icingaweb2/apache2.conf.erb'),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,13 +258,13 @@ describe 'icingaweb2', :type => :class do
|
||||||
context 'manage_apache_vhost => true' do
|
context 'manage_apache_vhost => true' do
|
||||||
let (:params) { { :manage_apache_vhost => true } }
|
let (:params) { { :manage_apache_vhost => true } }
|
||||||
|
|
||||||
pending
|
it { should contain_apache__custom_config('icingaweb2') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'manage_apache_vhost => false' do
|
context 'manage_apache_vhost => false' do
|
||||||
let (:params) { { :manage_apache_vhost => false } }
|
let (:params) { { :manage_apache_vhost => false } }
|
||||||
|
|
||||||
pending
|
it { should_not contain_apache__custom_config('icingaweb2') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -312,12 +312,34 @@ describe 'icingaweb2', :type => :class do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with parameter: web_root' do
|
describe 'with parameter: web_root' do
|
||||||
let (:params) { { :web_root => '/web/root' } }
|
context 'default' do
|
||||||
|
let (:params) { { :web_root => '/web/root' } }
|
||||||
|
|
||||||
it { should contain_file('/web/root').with(
|
it { should contain_file('/web/root').with(
|
||||||
'ensure' => 'directory'
|
'ensure' => 'directory'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'manage_apache_vhost => true' do
|
||||||
|
let (:params) {
|
||||||
|
{
|
||||||
|
:manage_apache_vhost => true,
|
||||||
|
:web_root => '/web/root'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
it { should contain_file('/web/root').with(
|
||||||
|
'ensure' => 'directory'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
it { should contain_apache__custom_config('icingaweb2').with(
|
||||||
|
'content' => /Alias.*\/web\/root/,
|
||||||
|
'content' => /<Directory.*\/web\/root/
|
||||||
|
)
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
45
templates/apache2.conf.erb
Normal file
45
templates/apache2.conf.erb
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
###################################################################
|
||||||
|
# #
|
||||||
|
# WARNING: This config file is automatically generated by Puppet. #
|
||||||
|
# ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN! #
|
||||||
|
# #
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
Alias /icingaweb2 "<%= @web_root %>/public"
|
||||||
|
|
||||||
|
<Directory "<%= @web_root %>/public">
|
||||||
|
Options SymLinksIfOwnerMatch
|
||||||
|
AllowOverride None
|
||||||
|
|
||||||
|
<IfModule mod_authz_core.c>
|
||||||
|
# Apache 2.4
|
||||||
|
<RequireAll>
|
||||||
|
Require all granted
|
||||||
|
</RequireAll>
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule !mod_authz_core.c>
|
||||||
|
# Apache 2.2
|
||||||
|
Order allow,deny
|
||||||
|
Allow from all
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
SetEnv ICINGAWEB_CONFIGDIR "<%= @config_dir %>"
|
||||||
|
|
||||||
|
EnableSendfile Off
|
||||||
|
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteBase /icingaweb2/
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} -d
|
||||||
|
RewriteRule ^.*$ - [NC,L]
|
||||||
|
RewriteRule ^.*$ index.php [NC,L]
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule !mod_rewrite.c>
|
||||||
|
DirectoryIndex error_norewrite.html
|
||||||
|
ErrorDocument 404 /error_norewrite.html
|
||||||
|
</IfModule>
|
||||||
|
</Directory>
|
Loading…
Reference in a new issue