diff --git a/manifests/server/proxy.pp b/manifests/server/proxy.pp index e39cb79..9d23732 100644 --- a/manifests/server/proxy.pp +++ b/manifests/server/proxy.pp @@ -19,10 +19,24 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # @summary Define manages the proxies for cd_haproxy. +# @param [string] haproxy_fqdn the fqdn of the haproxy server in question. # @param [string] frontend_name the name for the frontend section rule. -# @param [string] frontend_order the order where the concet should appear +# @param [string] frontend_order the order where the concat should appear # in the file. -############################################################################# +# @param [string] frontend_mode mode for the loadbalancer instance: http or tcp +# @param [string] fe_use_backend which backend to use. if left empty, the +# default backend will be used. +# @param [string] fe_bind_mode which bind mode to use, i.e. to which interface +# and poort to bind. +# @param [string] acl_rule an ACL rule to be inserted if required. Empty values +# will not be populated. +# @param [string] acl_order the order where the acl rule should be inserted, +# so it will be within the correct lb instance configuration. +# @param [string] backend_name the backend name to be used for the rule. +# @param [string] backend_order the order for the backend name, so it will be +# within the correct lb instance configuration. +# @param [string] fe_maxconn the maximum connections for the lb instance. +############################################################################### define cd_haproxy::server::proxy ( $haproxy_fqdn = undef, @@ -35,6 +49,9 @@ $acl_rule = '', $acl_order = '020', $backend_name = undef, $backend_order = '030', +$fe_maxconn = undef, +$be_server_name = undef, + ) { diff --git a/manifests/server/proxy_test.pp b/manifests/server/proxy_test.pp index 101b279..5856475 100644 --- a/manifests/server/proxy_test.pp +++ b/manifests/server/proxy_test.pp @@ -31,5 +31,6 @@ class cd_haproxy::server::proxy_test ( acl_rule => ['too_fast fe_sess_rate ge 10', 'network_allowed src 0.0.0.0/0'], backend_name => 'test01-backend', + be_server_name => ['web01', 'web02'], } } diff --git a/templates/haproxy_backend_rule.erb b/templates/haproxy_backend_rule.erb index 71e9e96..af53ab6 100644 --- a/templates/haproxy_backend_rule.erb +++ b/templates/haproxy_backend_rule.erb @@ -1,3 +1,5 @@ <% if @fqdn == @haproxy_fqdn -%> -backend <%= @backend_name %> +backend <%= @backend_name %> +<% @be_server_name.each do |be_server| -%> +server <%= be_server %> <% end -%> diff --git a/templates/haproxy_frontend_rule.erb b/templates/haproxy_frontend_rule.erb index 60616ec..3b569d7 100644 --- a/templates/haproxy_frontend_rule.erb +++ b/templates/haproxy_frontend_rule.erb @@ -2,6 +2,9 @@ frontend <%= @frontend_name %> mode <%= @frontend_mode %> bind <%= @fe_bind_mode %> +<% if @fe_maxconn != '' -%> +maxconn <%= @fe_maxconn %> +<% end -%> <% if @fe_use_backend != '' -%> use_backend <%= @fe_use_backend %> <% else -%>