Puppet Class: profile::opensearch::api::httpd_proxy
- Defined in:
- modules/profile/manifests/opensearch/api/httpd_proxy.pp
Overview
Class: profile::opensearch::api::httpd_proxy
Provisions the httpd reverse proxy for OpenSearch API
Parameters:
- $vhost: Apache vhost name
- $serveradmin: Email address for contacting server administrator
- $auth_type: Vhost auth type. One of ldap, local, local-api, none
- $accounts: hash of username -> htpasswd-hashed password for authentication
- $require_ssl: Require SSL connection to vhost?
- $auth_realm: HTTP basic auth realm description
- $auth_file: Path to htpasswd file for local auth types
- $group_file: Path to htgroup file for local auth types
filtertags: labs-project-deployment-prep
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 |
# File 'modules/profile/manifests/opensearch/api/httpd_proxy.pp', line 19
class profile::opensearch::api::httpd_proxy (
String $vhost = lookup('profile::opensearch::api::httpd_proxy::vhost'),
String $serveradmin = lookup('profile::opensearch::api::httpd_proxy::serveradmin'),
Pattern[/^local/, /^none$/] $auth_type = lookup('profile::opensearch::api::httpd_proxy::auth_type'),
Hash[String, String] $accounts = lookup('profile::opensearch::api::httpd_proxy::accounts'),
Hash[String, String] $groups = lookup('profile::opensearch::api::httpd_proxy::groups'),
Boolean $require_ssl = lookup('profile::opensearch::api::httpd_proxy::require_ssl', { 'default_value' => true }),
Optional[String] $auth_realm = lookup('profile::opensearch::api::httpd_proxy::auth_realm', { 'default_value' => undef }),
Optional[String] $auth_file = lookup('profile::opensearch::api::httpd_proxy::auth_file', { 'default_value' => undef }),
Optional[String] $group_file = lookup('profile::opensearch::api::httpd_proxy::group_file', { 'default_value' => undef }),
) {
if $auth_type =~ /^local/ {
$httpd_extra_modules = ['authz_groupfile', 'authz_user']
file { $auth_file:
ensure => present,
mode => '0400',
owner => 'www-data',
group => 'www-data',
content => ($accounts.map |$k, $v| { "${k}:${v}" } + ['']).join("\n"),
}
file { $group_file:
ensure => present,
mode => '0400',
owner => 'www-data',
group => 'www-data',
content => ($groups.map |$k, $v| { "${k}:${v}" } + ['']).join("\n"),
}
} elsif $auth_type == 'none' {
$httpd_extra_modules = []
file { $auth_file:
ensure => absent,
}
file { $group_file:
ensure => absent,
}
}
httpd::mod_conf { $httpd_extra_modules:
ensure => present,
}
$apache_auth = template("profile/opensearch/common/httpd_proxy/apache-auth-${auth_type}.erb")
httpd::site { $vhost:
content => template('profile/opensearch/api/httpd_proxy/apache.conf.erb'),
}
}
|