Skip to content

Commit 29eefef

Browse files
committed
Load Modules on platforms that need it.
1 parent 45213ff commit 29eefef

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

REFERENCE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ The following parameters are available in the `nginx` class:
258258
Data type: `Boolean`
259259

260260
When set, nginx will include module configurations files installed in the
261-
/etc/nginx/modules-enabled directory.
261+
/etc/nginx/modules-enabled directory. This is also enabled if mail is
262+
being configured (to allow the module to be loaded).
262263

263264
Default value: `$nginx::params::include_modules_enabled`
264265

manifests/init.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#
1111
# @param include_modules_enabled
1212
# When set, nginx will include module configurations files installed in the
13-
# /etc/nginx/modules-enabled directory.
13+
# /etc/nginx/modules-enabled directory. This is also enabled if mail is
14+
# being configured (to allow the module to be loaded).
1415
#
1516
# @param passenger_package_name
1617
# The name of the package to install in order for the passenger module of

manifests/resource/mailhost.pp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,16 @@
194194
package { $nginx::mail_package_name:
195195
ensure => 'installed',
196196
}
197+
$mail_load_content = $facts['os']['family'] ? {
198+
'ArchLinux' => 'load_module /usr/lib/nginx/modules/ngx_mail_module.so;',
199+
'RedHat' => 'load_module /usr/lib64/nginx/modules/ngx_mail_module.so;',
200+
}
201+
file { '/etc/nginx/modules-enabled/mail.conf':
202+
ensure => 'file',
203+
owner => 'root',
204+
mode => '0644',
205+
content => $mail_load_content,
206+
}
197207
}
198208

199209
# Add IPv6 Logic Check - Nginx service will not start if ipv6 is enabled

templates/conf.d/nginx.conf.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ load_module "<%= mod_item -%>";
66
load_module "modules/<%= mod_item -%>.so";
77
<%- end -%>
88
<%- end -%>
9+
910
<% if @daemon -%>
1011
daemon <%= @daemon %>;
1112
<% end -%>
@@ -23,7 +24,7 @@ pcre_jit <%= @pcre_jit %>;
2324
<% if @pid -%>
2425
pid <%= @pid %>;
2526
<% end -%>
26-
<% if @include_modules_enabled -%>
27+
<% if @include_modules_enabled or @mail -%>
2728
include /etc/nginx/modules-enabled/*.conf;
2829
<% end -%>
2930
<% if @nginx_cfg_prepend -%>

0 commit comments

Comments
 (0)