File tree Expand file tree Collapse file tree 7 files changed +26
-9
lines changed Expand file tree Collapse file tree 7 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -258,7 +258,8 @@ The following parameters are available in the `nginx` class:
258258Data type: ` Boolean `
259259
260260When 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
263264Default value: ` $nginx::params::include_modules_enabled `
264265
@@ -405,7 +406,7 @@ Data type: `Array[String]`
405406
406407
407408
408- Default value: ` $nginx::params::dynamic_modules `
409+ Default value: ` [] `
409410
410411##### <a name =" -nginx--global_owner " ></a >` global_owner `
411412
Original file line number Diff line number Diff line change 199199 }
200200 }
201201
202+ if ($include_modules_enabled or $nginx::mail ) {
203+ file { "${conf_dir}/modules-enabled" :
204+ ensure => directory ,
205+ }
206+ }
207+
202208 file { $log_dir:
203209 ensure => directory ,
204210 mode => $log_mode ,
Original file line number Diff line number Diff line change 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
224225 Optional[Enum[' on' , ' off' ]] $daemon = undef ,
225226 String[1] $daemon_user = $nginx::params::daemon_user,
226227 Optional[String[1]] $daemon_group = undef ,
227- Array[String] $dynamic_modules = $nginx::params::dynamic_modules ,
228+ Array[String] $dynamic_modules = [] ,
228229 String[1] $global_owner = ' root' ,
229230 String[1] $global_group = $nginx::params::global_group,
230231 Stdlib::Filemode $global_mode = ' 0644' ,
Original file line number Diff line number Diff line change 1717 ' mail_package_name' => undef ,
1818 ' manage_repo' => false ,
1919 ' include_modules_enabled' => false ,
20- ' dynamic_modules' => [],
2120 ' mime_types' => {
2221 ' text/html' => ' html htm shtml' ,
2322 ' text/css' => ' css' ,
149148 $_module_os_overrides = {
150149 ' log_group' => ' nginx' ,
151150 ' mail_package_name' => ' nginx-mod-mail' ,
152- ' dynamic_modules' => [' /usr/lib64/nginx/modules/ngx_mail_module.so' ],
153151 }
154152 }
155153 }
209207 $log_mode = $_module_parameters[' log_mode' ]
210208 $pid = $_module_parameters[' pid' ]
211209 $include_modules_enabled = $_module_parameters[' include_modules_enabled' ]
212- $dynamic_modules = $_module_parameters[' dynamic_modules' ]
213210
214211 $daemon_user = $_module_parameters[' daemon_user' ]
215212 $global_group = $_module_parameters[' root_group' ]
Original file line number Diff line number Diff line change 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;\n " ,
199+ ' RedHat' => " load_module /usr/lib64/nginx/modules/ngx_mail_module.so;\n " ,
200+ }
201+ file { '/etc/nginx/modules-enabled/mail.conf' :
202+ ensure => ' file' ,
203+ owner => ' root' ,
204+ mode => ' 0644' ,
205+ content => $mail_load_content ,
206+ require => File [' /etc/nginx/modules-enabled' ],
207+ }
197208 }
198209
199210 # Add IPv6 Logic Check - Nginx service will not start if ipv6 is enabled
Original file line number Diff line number Diff line change 1616 ipv6_enable : true
1717 }
1818 end
19- let ( :pre_condition ) { [ 'include nginx' ] }
19+ let ( :pre_condition ) { [ 'class { " nginx": mail => true } ' ] }
2020
2121 describe 'os-independent items' do
2222 describe 'basic assumptions' do
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ load_module "<%= mod_item -%>";
66load_module "modules/<%= mod_item -%> .so";
77 <%- end -%>
88<%- end -%>
9+
910<% if @daemon -%>
1011daemon <%= @daemon %> ;
1112<% end -%>
@@ -23,7 +24,7 @@ pcre_jit <%= @pcre_jit %>;
2324<% if @pid -%>
2425pid <%= @pid %> ;
2526<% end -%>
26- <% if @include_modules_enabled -%>
27+ <% if @include_modules_enabled or @mail -%>
2728include /etc/nginx/modules-enabled/*.conf;
2829<% end -%>
2930<% if @nginx_cfg_prepend -%>
You can’t perform that action at this time.
0 commit comments