2013-05-02 18:03:12 +02:00
|
|
|
#
|
2018-04-04 20:12:58 +02:00
|
|
|
# Copyright 2013 eNovance <licensing@enovance.com>
|
2013-05-02 18:03:12 +02:00
|
|
|
#
|
2018-04-04 20:12:58 +02:00
|
|
|
# Author: Francois Charlier <francois.charlier@enovance.com>
|
2013-05-02 18:03:12 +02:00
|
|
|
#
|
2018-04-04 20:12:58 +02:00
|
|
|
# == Class: keystone::wsgi::apache
|
2013-05-02 18:03:12 +02:00
|
|
|
#
|
2018-04-04 20:12:58 +02:00
|
|
|
# Serve keystone with apache mod_wsgi in place of keystone service
|
2013-05-02 18:03:12 +02:00
|
|
|
# When using this class you should disable your keystone service.
|
|
|
|
#
|
|
|
|
# == Parameters
|
|
|
|
#
|
2018-04-04 20:12:58 +02:00
|
|
|
# [*servername*]
|
|
|
|
# (Optional) The servername for the virtualhost.
|
|
|
|
# Defaults to $::fqdn
|
|
|
|
#
|
|
|
|
# [*bind_host*]
|
|
|
|
# (Optional) The host/ip address Apache will listen on.
|
|
|
|
# Defaults to undef (listen on all ip addresses)
|
|
|
|
#
|
2018-11-21 15:17:08 +01:00
|
|
|
# [*api_port*]
|
|
|
|
# (Optional) The keystone API port.
|
|
|
|
# Defaults to 5000
|
2018-04-04 20:12:58 +02:00
|
|
|
#
|
2018-11-21 15:17:08 +01:00
|
|
|
# [*path*]
|
|
|
|
# (Optional) The prefix for the API endpoint.
|
2018-04-04 20:12:58 +02:00
|
|
|
# Defaults to '/'
|
|
|
|
#
|
|
|
|
# [*ssl*]
|
|
|
|
# (Optional) Use SSL.
|
|
|
|
# Defaults to true
|
|
|
|
#
|
|
|
|
# [*workers*]
|
|
|
|
# (Optional) Number of WSGI workers to spawn.
|
2020-01-10 14:28:32 -05:00
|
|
|
# Defaults to $::os_workers_keystone
|
2018-04-04 20:12:58 +02:00
|
|
|
#
|
|
|
|
# [*ssl_cert*]
|
|
|
|
# (Optional) Path to SSL certificate
|
|
|
|
# Default to apache::vhost 'ssl_*' defaults
|
|
|
|
#
|
|
|
|
# [*ssl_key*]
|
|
|
|
# (Optional) Path to SSL key
|
|
|
|
# Default to apache::vhost 'ssl_*' defaults
|
|
|
|
#
|
|
|
|
# [*ssl_chain*]
|
|
|
|
# (Optional) SSL chain.
|
|
|
|
# Default to apache::vhost 'ssl_*' defaults
|
|
|
|
#
|
|
|
|
# [*ssl_ca*]
|
|
|
|
# (Optional) Path to SSL certificate authority.
|
|
|
|
# Default to apache::vhost 'ssl_*' defaults
|
|
|
|
#
|
|
|
|
# [*ssl_crl_path*]
|
|
|
|
# (Optional) Path to SSL certificate revocation list.
|
|
|
|
# Default to apache::vhost 'ssl_*' defaults
|
|
|
|
#
|
|
|
|
# [*ssl_crl*]
|
|
|
|
# (Optional) SSL certificate revocation list name.
|
|
|
|
# Default to apache::vhost 'ssl_*' defaults
|
|
|
|
#
|
|
|
|
# [*ssl_certs_dir*]
|
|
|
|
# (Optional) apache::vhost ssl parameters.
|
|
|
|
# Default to apache::vhost 'ssl_*' defaults
|
|
|
|
#
|
|
|
|
# [*priority*]
|
|
|
|
# (Optional) The priority for the vhost.
|
|
|
|
# Defaults to '10'
|
|
|
|
#
|
|
|
|
# [*threads*]
|
|
|
|
# (Optional) The number of threads for the vhost.
|
|
|
|
# Defaults to 1
|
|
|
|
#
|
|
|
|
# [*wsgi_application_group*]
|
|
|
|
# (Optional) The application group of the WSGI script.
|
|
|
|
# Defaults to '%{GLOBAL}'
|
|
|
|
#
|
|
|
|
# [*wsgi_pass_authorization*]
|
|
|
|
# (Optional) Whether HTTP authorisation headers are passed through to a WSGI
|
|
|
|
# script when the equivalent HTTP request headers are present.
|
|
|
|
# Defaults to 'On'
|
|
|
|
#
|
2018-11-21 15:17:08 +01:00
|
|
|
# [*wsgi_script_source*]
|
|
|
|
# (Optional) The wsgi script source for the API.
|
|
|
|
# This source is copied to the apache cgi-bin path as keystone-public.
|
|
|
|
# Defaults to '/usr/bin/keystone-wsgi-public'
|
2018-04-04 20:12:58 +02:00
|
|
|
#
|
2018-11-21 15:17:08 +01:00
|
|
|
# [*custom_wsgi_process_options*]
|
2018-04-04 20:12:58 +02:00
|
|
|
# (Optional) gives you the oportunity to add custom process options or to
|
2018-11-21 15:17:08 +01:00
|
|
|
# overwrite the default options for the WSGI process.
|
2018-04-04 20:12:58 +02:00
|
|
|
# For example to use a virtual python environment for the WSGI process
|
|
|
|
# you could set it to:
|
|
|
|
# { python-path => '/my/python/virtualenv' }
|
|
|
|
# Defaults to {}
|
|
|
|
#
|
|
|
|
# [*access_log_file*]
|
|
|
|
# (Optional) The log file name for the virtualhost.
|
|
|
|
# Defaults to false
|
|
|
|
#
|
|
|
|
# [*access_log_pipe*]
|
|
|
|
# (Optional) Specifies a pipe where Apache sends access logs for the virtualhost.
|
|
|
|
# Defaults to false
|
|
|
|
#
|
|
|
|
# [*access_log_syslog*]
|
|
|
|
# (Optional) Sends the virtualhost access log messages to syslog.
|
|
|
|
# Defaults to false
|
|
|
|
#
|
|
|
|
# [*access_log_format*]
|
|
|
|
# (Optional) The log format for the virtualhost.
|
|
|
|
# Defaults to false
|
|
|
|
#
|
|
|
|
# [*error_log_file*]
|
|
|
|
# (Optional) The error log file name for the virtualhost.
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
|
|
|
# [*error_log_pipe*]
|
|
|
|
# (Optional) Specifies a pipe where Apache sends error logs for the virtualhost.
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
|
|
|
# [*error_log_syslog*]
|
|
|
|
# (Optional) Sends the virtualhost error log messages to syslog.
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
|
|
|
# [*headers*]
|
|
|
|
# (Optional) Headers for the vhost.
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
|
|
|
# [*vhost_custom_fragment*]
|
|
|
|
# (Optional) Passes a string of custom configuration
|
|
|
|
# directives to be placed at the end of the vhost configuration.
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
|
|
|
# [*wsgi_chunked_request*]
|
|
|
|
# (Optional) apache::vhost wsgi_chunked_request parameter.
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
2013-05-02 18:03:12 +02:00
|
|
|
class keystone::wsgi::apache (
|
2017-06-10 12:00:21 +02:00
|
|
|
$servername = $::fqdn,
|
|
|
|
$bind_host = undef,
|
2018-11-21 15:17:08 +01:00
|
|
|
$api_port = 5000,
|
|
|
|
$path = '/',
|
2017-06-10 12:00:21 +02:00
|
|
|
$ssl = true,
|
2020-01-10 14:28:32 -05:00
|
|
|
$workers = $::os_workers_keystone,
|
2017-06-10 12:00:21 +02:00
|
|
|
$ssl_cert = undef,
|
|
|
|
$ssl_key = undef,
|
|
|
|
$ssl_chain = undef,
|
|
|
|
$ssl_ca = undef,
|
|
|
|
$ssl_crl_path = undef,
|
|
|
|
$ssl_crl = undef,
|
|
|
|
$ssl_certs_dir = undef,
|
2017-10-13 07:59:57 +03:00
|
|
|
$threads = 1,
|
2017-06-10 12:00:21 +02:00
|
|
|
$priority = '10',
|
|
|
|
$wsgi_application_group = '%{GLOBAL}',
|
|
|
|
$wsgi_pass_authorization = 'On',
|
|
|
|
$wsgi_chunked_request = undef,
|
2018-11-21 15:17:08 +01:00
|
|
|
$wsgi_script_source = '/usr/bin/keystone-wsgi-public',
|
2017-07-31 14:18:34 +02:00
|
|
|
$access_log_file = false,
|
|
|
|
$access_log_pipe = false,
|
|
|
|
$access_log_syslog = false,
|
2017-06-10 12:00:21 +02:00
|
|
|
$access_log_format = false,
|
2017-07-31 14:18:34 +02:00
|
|
|
$error_log_file = undef,
|
|
|
|
$error_log_pipe = undef,
|
|
|
|
$error_log_syslog = undef,
|
2017-06-10 12:00:21 +02:00
|
|
|
$headers = undef,
|
|
|
|
$vhost_custom_fragment = undef,
|
2018-11-21 15:17:08 +01:00
|
|
|
$custom_wsgi_process_options = {},
|
2016-07-06 09:29:29 -06:00
|
|
|
) inherits ::keystone::params {
|
2013-05-02 18:03:12 +02:00
|
|
|
|
2019-12-08 23:09:22 +01:00
|
|
|
include keystone::deps
|
2016-09-05 08:50:10 +03:00
|
|
|
|
2018-11-21 15:17:08 +01:00
|
|
|
# TODO(tobias-urdin): This dependency chaining can be moved to keystone::deps
|
|
|
|
# when we have cleaned up some old eventlet code and users are forced to use
|
|
|
|
# apache even though it's pretty much enforced today.
|
2013-05-02 18:03:12 +02:00
|
|
|
|
2016-02-23 18:31:15 -07:00
|
|
|
# The httpd package is untagged, but needs to have ordering enforced,
|
|
|
|
# so handle it here rather than in the deps class.
|
|
|
|
Anchor['keystone::install::begin']
|
|
|
|
-> Package['httpd']
|
|
|
|
-> Anchor['keystone::install::end']
|
|
|
|
|
|
|
|
# Configure apache during the config phase
|
|
|
|
Anchor['keystone::config::begin']
|
|
|
|
-> Apache::Vhost<||>
|
|
|
|
~> Anchor['keystone::config::end']
|
|
|
|
|
|
|
|
# Start the service during the service phase
|
|
|
|
Anchor['keystone::service::begin']
|
|
|
|
-> Service['httpd']
|
|
|
|
-> Anchor['keystone::service::end']
|
|
|
|
|
|
|
|
# Notify the service when config changes
|
|
|
|
Anchor['keystone::config::end']
|
|
|
|
~> Service['httpd']
|
2013-05-02 18:03:12 +02:00
|
|
|
|
2018-11-21 15:17:08 +01:00
|
|
|
::openstacklib::wsgi::apache { 'keystone_wsgi':
|
2013-05-02 18:03:12 +02:00
|
|
|
servername => $servername,
|
2018-04-04 20:12:58 +02:00
|
|
|
bind_host => $bind_host,
|
2018-11-21 15:17:08 +01:00
|
|
|
bind_port => $api_port,
|
|
|
|
group => $::keystone::params::keystone_group,
|
|
|
|
path => $path,
|
2018-04-04 20:12:58 +02:00
|
|
|
workers => $workers,
|
|
|
|
threads => $threads,
|
2018-11-21 15:17:08 +01:00
|
|
|
user => $::keystone::params::keystone_user,
|
2014-07-17 16:22:34 -06:00
|
|
|
priority => $priority,
|
2013-05-02 18:03:12 +02:00
|
|
|
ssl => $ssl,
|
|
|
|
ssl_cert => $ssl_cert,
|
|
|
|
ssl_key => $ssl_key,
|
|
|
|
ssl_chain => $ssl_chain,
|
|
|
|
ssl_ca => $ssl_ca,
|
|
|
|
ssl_crl_path => $ssl_crl_path,
|
|
|
|
ssl_crl => $ssl_crl,
|
|
|
|
ssl_certs_dir => $ssl_certs_dir,
|
2018-11-21 15:17:08 +01:00
|
|
|
wsgi_daemon_process => 'keystone',
|
|
|
|
wsgi_process_display_name => 'keystone',
|
|
|
|
wsgi_process_group => 'keystone',
|
2018-04-04 20:12:58 +02:00
|
|
|
wsgi_script_dir => $::keystone::params::keystone_wsgi_script_path,
|
2018-11-21 15:17:08 +01:00
|
|
|
wsgi_script_file => 'keystone',
|
|
|
|
wsgi_script_source => $wsgi_script_source,
|
2015-10-02 23:18:55 +03:00
|
|
|
wsgi_application_group => $wsgi_application_group,
|
|
|
|
wsgi_pass_authorization => $wsgi_pass_authorization,
|
2014-10-27 09:45:08 -07:00
|
|
|
wsgi_chunked_request => $wsgi_chunked_request,
|
2018-04-04 20:12:58 +02:00
|
|
|
headers => $headers,
|
2018-11-21 15:17:08 +01:00
|
|
|
custom_wsgi_process_options => $custom_wsgi_process_options,
|
2018-04-04 20:12:58 +02:00
|
|
|
vhost_custom_fragment => $vhost_custom_fragment,
|
2017-07-31 14:18:34 +02:00
|
|
|
access_log_file => $access_log_file,
|
|
|
|
access_log_pipe => $access_log_pipe,
|
|
|
|
access_log_syslog => $access_log_syslog,
|
2015-08-12 10:21:43 -06:00
|
|
|
access_log_format => $access_log_format,
|
2017-07-31 14:18:34 +02:00
|
|
|
error_log_file => $error_log_file,
|
|
|
|
error_log_pipe => $error_log_pipe,
|
|
|
|
error_log_syslog => $error_log_syslog,
|
2013-05-02 18:03:12 +02:00
|
|
|
}
|
2019-04-24 15:38:21 -06:00
|
|
|
|
|
|
|
# Workaround to empty Keystone vhost that is provided & activated by default with running
|
|
|
|
# Canonical packaging (called 'keystone'). This will make sure upgrading the package is
|
|
|
|
# possible, see https://bugs.launchpad.net/ubuntu/+source/keystone/+bug/1737697
|
|
|
|
if ($::operatingsystem == 'Ubuntu') {
|
|
|
|
ensure_resource('file', '/etc/apache2/sites-available/keystone.conf', {
|
|
|
|
'ensure' => 'file',
|
|
|
|
'content' => '',
|
|
|
|
})
|
|
|
|
|
|
|
|
Package<| tag == 'keystone-package' |>
|
|
|
|
-> File<| title == '/etc/apache2/sites-available/keystone.conf' |>
|
|
|
|
~> Anchor['keystone::install::end']
|
|
|
|
}
|
2013-05-02 18:03:12 +02:00
|
|
|
}
|