adds backend rule

This commit is contained in:
Arne Teuke
2019-01-07 20:00:18 +01:00
parent 0f6f603f8f
commit b7acbbfb73
4 changed files with 26 additions and 3 deletions

View File

@@ -19,10 +19,24 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# @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,
) {

View File

@@ -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'],
}
}

View File

@@ -1,3 +1,5 @@
<% if @fqdn == @haproxy_fqdn -%>
backend <%= @backend_name %>
<% @be_server_name.each do |be_server| -%>
server <%= be_server %>
<% end -%>

View File

@@ -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 -%>