-
Notifications
You must be signed in to change notification settings - Fork 66
/
apache.pp
193 lines (174 loc) · 5.8 KB
/
apache.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# configure apache
# @api private
class pulp::apache {
include apache
include apache::mod::proxy
include apache::mod::proxy_http
include apache::mod::wsgi
include apache::mod::ssl
include apache::mod::xsendfile
# This file is installed by pulp-server but we manage it ourselves.
# Yum/RPM will restore deleted files on upgrade so we write some dummy value
file {'/etc/httpd/conf.d/pulp.conf':
ensure => file,
content => "# This file is managed by puppet, do not alter.\n",
owner => 'root',
group => 'root',
mode => '0644',
notify => Service['httpd'],
}
if $pulp::manage_httpd {
if $pulp::enable_http or $pulp::enable_puppet {
apache::vhost { 'pulp-http':
priority => '05',
docroot => '/usr/share/pulp/wsgi',
port => $pulp::http_port,
servername => $facts['networking']['fqdn'],
serveraliases => [$facts['networking']['hostname']],
additional_includes => "${apache::confd_dir}/pulp-vhosts80/*.conf",
}
}
$webservices_wsgi_directory = {
'path' => 'webservices.wsgi',
'provider' => 'files',
}
if $pulp::ldap_url {
include apache::mod::authnz_ldap
$ldap_custom_fragment = {
'custom_fragment' => template('pulp/ldap_custom_fragment.erb'),
'require' => 'unmanaged',
}
} else {
$ldap_custom_fragment = {}
}
$base_directories = [
merge($webservices_wsgi_directory, $ldap_custom_fragment),
{
'path' => '/usr/share/pulp/wsgi',
'provider' => 'directory',
},
{
'path' => '/pulp/static',
'provider' => 'location',
},
]
if $pulp::ssl_username and !empty($pulp::ssl_username) {
$directories = concat(
$base_directories,
{
'path' => '/pulp/api',
'provider' => 'location',
'custom_fragment' => "SSLUsername ${pulp::ssl_username}",
}
)
} else {
$directories = $base_directories
}
$aliases = [
{
alias => '/pulp/static',
path => '/var/lib/pulp/static',
options => ['Indexes'],
custom_fragment => 'SSLRequireSSL',
},
]
apache::vhost { 'pulp-https':
priority => '05',
docroot => '/usr/share/pulp/wsgi',
port => $pulp::https_port,
servername => $facts['networking']['fqdn'],
serveraliases => [$facts['networking']['hostname']],
keepalive => 'on',
max_keepalive_requests => $pulp::max_keep_alive,
ssl => true,
ssl_cert => $pulp::https_cert,
ssl_key => $pulp::https_key,
ssl_chain => $pulp::https_chain,
ssl_ca => pick($pulp::https_ca_cert, $pulp::ca_cert),
ssl_certs_dir => '',
ssl_verify_client => 'optional',
ssl_protocol => $pulp::ssl_protocol,
ssl_options => '+StdEnvVars +ExportCertData',
ssl_verify_depth => '3',
wsgi_process_group => 'pulp',
wsgi_application_group => 'pulp',
wsgi_daemon_process => join([
'pulp',
'user=apache',
'group=apache',
"processes=${pulp::wsgi_processes}",
"maximum-requests=${pulp::wsgi_max_requests}",
'display-name=%{GROUP}',
], ' '),
wsgi_pass_authorization => 'On',
wsgi_import_script => '/usr/share/pulp/wsgi/webservices.wsgi',
wsgi_import_script_options => {
'process-group' => 'pulp',
'application-group' => 'pulp',
},
wsgi_script_aliases => merge(
{'/pulp/api' => '/usr/share/pulp/wsgi/webservices.wsgi'},
$pulp::additional_wsgi_scripts
),
directories => $directories,
aliases => $aliases,
options => ['SymLinksIfOwnerMatch'],
add_default_charset => 'UTF-8',
# allow older yum clients to connect, see bz 647828
custom_fragment => 'SSLInsecureRenegotiation On',
}
} else {
file {'/etc/httpd/conf.d/10-pulp.conf':
ensure => file,
content => template('pulp/pulp.conf.erb'),
owner => 'root',
group => 'root',
mode => '0644',
notify => Service['httpd'],
}
}
if $pulp::manage_httpd or $pulp::manage_plugins_httpd {
pulp::apache_plugin {'content' : vhosts80 => false}
file { "${apache::confd_dir}/pulp-vhosts80/":
ensure => directory,
owner => 'apache',
group => 'apache',
mode => '0755',
purge => true,
require => Package['pulp-server'],
}
if $pulp::enable_rpm {
pulp::apache_plugin { 'rpm': }
}
if $pulp::enable_deb {
pulp::apache_plugin { 'deb': vhosts80 => false }
}
if $pulp::enable_iso {
pulp::apache_plugin { 'iso': }
}
if $pulp::enable_docker {
include apache::mod::headers
pulp::apache_plugin { 'docker': vhosts80 => false }
}
if $pulp::enable_puppet {
pulp::apache_plugin { 'puppet': }
}
if $pulp::enable_python {
pulp::apache_plugin { 'python': }
}
if $pulp::enable_ostree {
pulp::apache_plugin { 'ostree': vhosts80 => false }
}
if $pulp::enable_parent_node {
pulp::apache_plugin { 'nodes': vhosts80 => false }
}
}
file {'/etc/httpd/conf.d/pulp_streamer.conf':
ensure => file,
content => template('pulp/etc/httpd/conf.d/pulp_streamer.conf.erb'),
owner => 'root',
group => 'root',
mode => '0644',
notify => Service['httpd'],
}
}