diff --git a/deployment/puppet/horizon/manifests/init.pp b/deployment/puppet/horizon/manifests/init.pp index e93388986e..3118e679ee 100644 --- a/deployment/puppet/horizon/manifests/init.pp +++ b/deployment/puppet/horizon/manifests/init.pp @@ -87,10 +87,32 @@ class horizon( content => "LoadModule wsgi_module modules/mod_wsgi.so\n", require => Package["$::horizon::params::http_service", "$::horizon::params::http_modwsgi"], before => Package["$::horizon::params::package_name"], - } + } # ensure there is a HTTP redirect from / to /dashboard + file_line { 'horizon_redirect_rule': + path => $::horizon::params::dashboard_config_file, + line => 'RedirectMatch permanent ^/$ /dashboard/', + require => Package["$::horizon::params::package_name"], + notify => Service["$::horizon::params::http_service"] + } + file_line { 'httpd_listen_on_internal_network_only': + path => $::horizon::params::httpd_listen_config_file, + match => '^Listen (.*)$', + line => "Listen ${bind_address}:80", + before => [Service["$::horizon::params::http_service"]], + notify => [Service["$::horizon::params::http_service"]], + require =>[Package["$::horizon::params::package_name"]] + } } - 'Debian': { + file {'/etc/apache2': + ensure => directory, + require => [] + } + file { $::horizon::params::httpd_listen_config_file: + content => template('horizon/ports.conf.erb'), + require => File['/etc/apache2'], + before => Package[$::horizon::params::package_name], + } exec { 'a2enmod wsgi': command => 'a2enmod wsgi', path => ['/usr/bin','/usr/sbin','/bin/','/sbin'], @@ -100,25 +122,8 @@ class horizon( } } - # ensure there is a HTTP redirect from / to /dashboard - file_line { 'horizon_redirect_rule': - path => $::horizon::params::dashboard_config_file, - line => 'RedirectMatch permanent ^/$ /dashboard/', - require => Package["$::horizon::params::package_name"], - notify => Service["$::horizon::params::http_service"] - } - # ensure https only listens on the management address, not on all interfaces - file_line { 'httpd_listen_on_internal_network_only': - path => $::horizon::params::httpd_listen_config_file, - match => '^Listen (.*)$', - line => "Listen ${bind_address}:80", - before => Service["$::horizon::params::http_service"], - require => Package["$::horizon::params::package_name"], - notify => Service["$::horizon::params::http_service"] - } -#case $::osfamily -# 'RedHat': { + service { '$::horizon::params::http_service': name => $::horizon::params::http_service, ensure => 'running', @@ -126,15 +131,4 @@ class horizon( require => Package["$::horizon::params::http_service", "$::horizon::params::http_modwsgi"], subscribe => File["$::horizon::params::local_settings_path", "$::horizon::params::logdir"] } -# } -# 'Debian': { -# service { '$::horizon::params::http_service': -# name => $::horizon::params::http_service, -# ensure => 'running', -# enable => true, -# require => Package["$::horizon::params::http_service", "$::horizon::params::http_modwsgi"], -# subscribe => File["$::horizon::params::local_settings_path", "$::horizon::params::logdir"] -# } -# } -# } } diff --git a/deployment/puppet/horizon/templates/ports.conf.erb b/deployment/puppet/horizon/templates/ports.conf.erb new file mode 100644 index 0000000000..a5837c7057 --- /dev/null +++ b/deployment/puppet/horizon/templates/ports.conf.erb @@ -0,0 +1,12 @@ +NameVirtualHost *:80 +Listen <%= bind_address %>:80 + + + Listen <%= bind_address %>:443 + + + + Listen <%= bind_address %>:443 + + +