Add possibility to preserve previous apache deployment

By default radosgw deployment for apache vhost destroys
already existing apache configs. This patch gives possibility
to configure radosgw vhost w/o any modifications.

Change-Id: I737a55cadb15f3c96825116b6563380d2460d5c4
Closes-Bug: 1528609
This commit is contained in:
Oleksiy Molchanov
2015-12-22 17:49:27 +02:00
parent 535ceb23bc
commit b7b9ca415b
5 changed files with 185 additions and 64 deletions

View File

@@ -51,13 +51,13 @@
# for more info on repository recommendations.
#
define ceph::rgw::apache (
$admin_email = 'root@localhost',
$docroot = '/var/www',
$fcgi_file = '/var/www/s3gw.fcgi',
$rgw_dns_name = $::fqdn,
$rgw_port = 80,
$rgw_socket_path = $::ceph::params::rgw_socket_path,
$syslog = true,
$admin_email = 'root@localhost',
$docroot = '/var/www',
$fcgi_file = '/var/www/s3gw.fcgi',
$rgw_dns_name = $::fqdn,
$rgw_port = 80,
$rgw_socket_path = $::ceph::params::rgw_socket_path,
$syslog = true,
$ceph_apache_repo = true,
) {

View File

@@ -50,23 +50,54 @@
# http://ceph.com/docs/master/install/install-ceph-gateway/
# for more info on repository recommendations.
#
# [*apache_mods*] Whether to configure and enable a set of default Apache modules.
# Optional. Defaults to false.
#
# [*apache_vhost*] Configures a default virtual host.
# Optional. Defaults to false.
#
# [*apache_purge_configs*] Removes all other Apache configs and virtual hosts.
# Optional. Defaults to true.
#
# [*apache_purge_vhost*] Whether to remove any configurations inside vhost_dir not managed
# by Puppet.
# Optional. Defaults to true.
#
# [*custom_apache_ports*] Array of ports to listen by Apache.
# Optional. Works only if custom_apache set to true. Default is undef.
#
define ceph::rgw::apache_fastcgi (
$admin_email = 'root@localhost',
$docroot = '/var/www',
$fcgi_file = '/var/www/s3gw.fcgi',
$rgw_dns_name = $::fqdn,
$rgw_port = 80,
$rgw_socket_path = $::ceph::params::rgw_socket_path,
$syslog = true,
$ceph_apache_repo = true,
$admin_email = 'root@localhost',
$docroot = '/var/www',
$fcgi_file = '/var/www/s3gw.fcgi',
$rgw_dns_name = $::fqdn,
$rgw_port = '80',
$rgw_socket_path = $::ceph::params::rgw_socket_path,
$syslog = true,
$ceph_apache_repo = true,
$apache_mods = false,
$apache_vhost = false,
$apache_purge_configs = true,
$apache_purge_vhost = true,
$custom_apache_ports = undef,
) {
class { '::apache':
default_mods => false,
default_vhost => false,
default_mods => $apache_mods,
default_vhost => $apache_vhost,
purge_configs => $apache_purge_configs,
purge_vhost_dir => $apache_purge_vhost,
}
if $custom_apache_ports {
apache::listen { $custom_apache_ports: }
}
if !$apache_mods {
include ::apache::mod::auth_basic
}
include ::apache::mod::alias
include ::apache::mod::auth_basic
include ::apache::mod::mime
include ::apache::mod::rewrite

View File

@@ -48,28 +48,58 @@
# [*syslog*] Whether or not to log to syslog.
# Optional. Default is true.
#
# [*apache_mods*] Whether to configure and enable a set of default Apache modules.
# Optional. Defaults to false.
#
# [*apache_vhost*] Configures a default virtual host.
# Optional. Defaults to false.
#
# [*apache_purge_configs*] Removes all other Apache configs and virtual hosts.
# Optional. Defaults to true.
#
# [*apache_purge_vhost*] Whether to remove any configurations inside vhost_dir not managed
# by Puppet.
# Optional. Defaults to true.
#
# [*custom_apache_ports*] Array of ports to listen by Apache.
# Optional. Works only if custom_apache set to true. Default is undef.
#
define ceph::rgw::apache_proxy_fcgi (
$admin_email = 'root@localhost',
$docroot = '/var/www',
$rgw_dns_name = $::fqdn,
$rgw_port = 80,
$rewrite_rule = '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
$setenv = 'proxy-nokeepalive 1',
$proxy_pass = {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
$syslog = true,
$admin_email = 'root@localhost',
$docroot = '/var/www',
$rgw_dns_name = $::fqdn,
$rgw_port = '80',
$rewrite_rule = '.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]',
$setenv = 'proxy-nokeepalive 1',
$proxy_pass = {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
$syslog = true,
$apache_mods = false,
$apache_vhost = false,
$apache_purge_configs = true,
$apache_purge_vhost = true,
$custom_apache_ports = undef,
) {
class { '::apache':
default_mods => false,
default_vhost => false,
default_mods => $apache_mods,
default_vhost => $apache_vhost,
purge_configs => $apache_purge_configs,
purge_vhost_dir => $apache_purge_vhost,
}
if $custom_apache_ports {
apache::listen { $custom_apache_ports: }
}
if !$apache_mods {
include ::apache::mod::auth_basic
::apache::mod { 'env': }
}
include ::apache::mod::alias
include ::apache::mod::auth_basic
include ::apache::mod::mime
include ::apache::mod::rewrite
include ::apache::mod::proxy
::apache::mod { 'proxy_fcgi': }
::apache::mod { 'env': }
apache::vhost { "${rgw_dns_name}-radosgw":
servername => $rgw_dns_name,

View File

@@ -62,7 +62,12 @@ describe 'ceph::rgw::apache_fastcgi' do
'fastcgi_dir' => '/var/www',
})}
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache').with(
'default_mods' => false,
'default_vhost' => false,
'purge_configs' => true,
'purge_vhost_dir' => true,
)}
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::fastcgi') }
@@ -88,12 +93,17 @@ exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n radosgw.gateway",
let :params do
{
:rgw_dns_name => 'mydns.hostname',
:rgw_socket_path => '/some/location/radosgw.sock',
:rgw_port => 1111,
:admin_email => 'admin@hostname',
:fcgi_file => '/some/fcgi/filepath',
:syslog => false,
:rgw_dns_name => 'mydns.hostname',
:rgw_socket_path => '/some/location/radosgw.sock',
:rgw_port => 1111,
:admin_email => 'admin@hostname',
:fcgi_file => '/some/fcgi/filepath',
:syslog => false,
:apache_mods => true,
:apache_vhost => true,
:apache_purge_configs => false,
:apache_purge_vhost => false,
:custom_apache_ports => '8888',
}
end
@@ -110,9 +120,14 @@ exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n radosgw.gateway",
'fastcgi_dir' => '/var/www',
} ) }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache').with(
'default_mods' => true,
'default_vhost' => true,
'purge_configs' => false,
'purge_vhost_dir' => false,
)}
it { is_expected.to contain_apache__listen('8888') }
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::fastcgi') }
it { is_expected.to contain_class('apache::mod::mime') }
it { is_expected.to contain_class('apache::mod::rewrite') }
@@ -156,7 +171,12 @@ exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n radosgw.gateway",
'fastcgi_dir' => '/var/www',
})}
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache').with(
'default_mods' => false,
'default_vhost' => false,
'purge_configs' => true,
'purge_vhost_dir' => true,
)}
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::fastcgi') }
@@ -182,15 +202,27 @@ exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n radosgw.gateway",
let :params do
{
:rgw_dns_name => 'mydns.hostname',
:rgw_socket_path => '/some/location/radosgw.sock',
:rgw_port => 1111,
:admin_email => 'admin@hostname',
:fcgi_file => '/some/fcgi/filepath',
:syslog => false,
:rgw_dns_name => 'mydns.hostname',
:rgw_socket_path => '/some/location/radosgw.sock',
:rgw_port => 1111,
:admin_email => 'admin@hostname',
:fcgi_file => '/some/fcgi/filepath',
:syslog => false,
:apache_mods => true,
:apache_vhost => true,
:apache_purge_configs => false,
:apache_purge_vhost => false,
:custom_apache_ports => '8888',
}
end
it { is_expected.to contain_class('apache').with(
'default_mods' => true,
'default_vhost' => true,
'purge_configs' => false,
'purge_vhost_dir' => false,
)}
it { is_expected.to contain_apache__listen('8888') }
it { is_expected.to contain_apache__vhost('mydns.hostname-radosgw').with( {
'servername' => 'mydns.hostname',
'serveradmin' => 'admin@hostname',
@@ -204,9 +236,7 @@ exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n radosgw.gateway",
'fastcgi_dir' => '/var/www',
} ) }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::fastcgi') }
it { is_expected.to contain_class('apache::mod::mime') }
it { is_expected.to contain_class('apache::mod::rewrite') }

View File

@@ -54,7 +54,12 @@ describe 'ceph::rgw::apache_proxy_fcgi' do
'proxy_pass' => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
})}
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache').with(
'default_mods' => false,
'default_vhost' => false,
'purge_configs' => true,
'purge_vhost_dir' => true,
)}
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::proxy') }
@@ -71,14 +76,26 @@ describe 'ceph::rgw::apache_proxy_fcgi' do
let :params do
{
:rgw_dns_name => 'mydns.hostname',
:rgw_port => 1111,
:admin_email => 'admin@hostname',
:syslog => false,
:proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
:rgw_dns_name => 'mydns.hostname',
:rgw_port => 1111,
:admin_email => 'admin@hostname',
:syslog => false,
:proxy_pass => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
:apache_mods => true,
:apache_vhost => true,
:apache_purge_configs => false,
:apache_purge_vhost => false,
:custom_apache_ports => '8888',
}
end
it { is_expected.to contain_class('apache').with(
'default_mods' => true,
'default_vhost' => true,
'purge_configs' => false,
'purge_vhost_dir' => false,
)}
it { is_expected.to contain_apache__listen('8888') }
it { is_expected.to contain_apache__vhost('mydns.hostname-radosgw').with( {
'servername' => 'mydns.hostname',
'serveradmin' => 'admin@hostname',
@@ -91,9 +108,7 @@ describe 'ceph::rgw::apache_proxy_fcgi' do
'proxy_pass' => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
} ) }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::proxy') }
it { is_expected.to contain_class('apache::mod::mime') }
it { is_expected.to contain_class('apache::mod::rewrite') }
@@ -133,7 +148,12 @@ describe 'ceph::rgw::apache_proxy_fcgi' do
'proxy_pass' => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9000/'},
})}
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache').with(
'default_mods' => false,
'default_vhost' => false,
'purge_configs' => true,
'purge_vhost_dir' => true,
)}
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::proxy') }
@@ -150,14 +170,26 @@ describe 'ceph::rgw::apache_proxy_fcgi' do
let :params do
{
:rgw_dns_name => 'mydns.hostname',
:rgw_port => 1111,
:admin_email => 'admin@hostname',
:syslog => false,
:proxy_pass => {'path'=>'/', 'url'=>'fcgi://127.0.0.1:9999/'},
:rgw_dns_name => 'mydns.hostname',
:rgw_port => 1111,
:admin_email => 'admin@hostname',
:syslog => false,
:proxy_pass => {'path'=>'/', 'url'=>'fcgi://127.0.0.1:9999/'},
:apache_mods => true,
:apache_vhost => true,
:apache_purge_configs => false,
:apache_purge_vhost => false,
:custom_apache_ports => '8888',
}
end
it { is_expected.to contain_class('apache').with(
'default_mods' => true,
'default_vhost' => true,
'purge_configs' => false,
'purge_vhost_dir' => false,
)}
it { is_expected.to contain_apache__listen('8888') }
it { is_expected.to contain_apache__vhost('mydns.hostname-radosgw').with( {
'servername' => 'mydns.hostname',
'serveradmin' => 'admin@hostname',
@@ -170,9 +202,7 @@ describe 'ceph::rgw::apache_proxy_fcgi' do
'proxy_pass' => {'path' => '/', 'url' => 'fcgi://127.0.0.1:9999/'},
} ) }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::alias') }
it { is_expected.to contain_class('apache::mod::auth_basic') }
it { is_expected.to contain_class('apache::mod::proxy') }
it { is_expected.to contain_class('apache::mod::mime') }
it { is_expected.to contain_class('apache::mod::rewrite') }