diff --git a/manifests/resource/upstream.pp b/manifests/resource/upstream.pp index c74492a..86e672e 100644 --- a/manifests/resource/upstream.pp +++ b/manifests/resource/upstream.pp @@ -8,6 +8,7 @@ # [*ensure*] - Enables or disables the specified location (present|absent) # [*upstream_cfg_prepend*] - It expects a hash with custom directives to put before anything else inside upstream # [*upstream_fail_timeout*] - Set the fail_timeout for the upstream. Default is 10 seconds - As that is what Nginx does normally. +# [*upstream_max_fails*] - Set the max_fails for the upstream. Default is to use nginx default value which is 1. # # Actions: # @@ -43,6 +44,7 @@ define nginx::resource::upstream ( $ensure = 'present', $upstream_cfg_prepend = undef, $upstream_fail_timeout = '10s', + $upstream_max_fails = undef, ) { if $members != undef { diff --git a/templates/conf.d/upstream_member.erb b/templates/conf.d/upstream_member.erb index 081177b..5f44b54 100644 --- a/templates/conf.d/upstream_member.erb +++ b/templates/conf.d/upstream_member.erb @@ -1 +1 @@ - server <%= @server %>:<%= @port %> fail_timeout=<%= @upstream_fail_timeout %>; + server <%= @server %>:<%= @port %> fail_timeout=<%= @upstream_fail_timeout %><% if @upstream_max_fails -%> max_fails=<%=@upstream_max_fails %><% end %>; diff --git a/templates/conf.d/upstream_members.erb b/templates/conf.d/upstream_members.erb index d7a2dda..0f5c306 100644 --- a/templates/conf.d/upstream_members.erb +++ b/templates/conf.d/upstream_members.erb @@ -1,2 +1,2 @@ <% @members.each do |i| %> - server <%= i %> fail_timeout=<%= @upstream_fail_timeout %>;<% end %> + server <%= i %> fail_timeout=<%= @upstream_fail_timeout %><% if @upstream_max_fails -%> max_fails=<%=@upstream_max_fails %><% end %>;<% end %>