From e14be7f56c8af202fd7ee52d8a33c67d948be4bc Mon Sep 17 00:00:00 2001 From: Arne Teuke Date: Thu, 30 Jan 2025 00:07:00 +0100 Subject: [PATCH] add tail --- manifests/main/files.pp | 9 +++++++++ manifests/params.pp | 21 +-------------------- manifests/server/proxy.pp | 2 ++ templates/haproxy_tail.erb | 4 ++++ 4 files changed, 16 insertions(+), 20 deletions(-) create mode 100644 templates/haproxy_tail.erb diff --git a/manifests/main/files.pp b/manifests/main/files.pp index 78f44c7..11a0ec1 100644 --- a/manifests/main/files.pp +++ b/manifests/main/files.pp @@ -47,6 +47,15 @@ class cd_haproxy::main::files ( order => '001', } + + # create the header + concat::fragment { 'tail': + target => $hy_main_config, + content => template($hy_config_tail_erb), + order => '100', + } + + # pid file file { $hy_pid: ensure => file, diff --git a/manifests/params.pp b/manifests/params.pp index 53d556f..a686a47 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,26 +1,6 @@ ## cd_haproxy::params.pp # Module name: cd_haproxy # Author: Arne Teuke (arne_teuke@confdroid.com) -# License: -# This file is part of cd_haproxy. -# -# cd_haproxy is used for providing automatic configuration of HA proxy. -# Copyright (C) 2017 confdroid (copyright@confdroid.com) -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# @summary Class holds all parameters for the cd_haproxy module and is -# inherited by all classes except defines. -# @see https://cbonte.github.io/haproxy-dconv/1.5/configuration.html # @param [string] pkg_ensure # which [package type](https://confdroid.com/2017/05/puppet-type-package/) # to choose, i.e. `latest` or `present`. @@ -132,6 +112,7 @@ $hy_errors_dir = "${hy_main_dir}/errors" # files $hy_main_config = "${hy_main_dir}/haproxy.cfg" $hy_config_head_erb = 'cd_haproxy/haproxy_head.erb' +$hy_config_tail_erb = 'cd_haproxy/haproxy_tail.erb' $hy_400_file = "${hy_errors_dir}/400.http" $hy_400_erb = 'cd_haproxy/errors/400_http.erb' $hy_403_file = "${hy_errors_dir}/403.http" diff --git a/manifests/server/proxy.pp b/manifests/server/proxy.pp index 785a749..7829516 100644 --- a/manifests/server/proxy.pp +++ b/manifests/server/proxy.pp @@ -49,6 +49,7 @@ define cd_haproxy::server::proxy ( $hy_acl_rule = 'cd_haproxy/haproxy_acl_rule.erb' + # Ensure acl_rule_front and acl_rule_back are arrays $acl_rule_front_array = split($acl_rule_front, ';') $acl_rule_back_array = split($acl_rule_back, ';') @@ -71,4 +72,5 @@ define cd_haproxy::server::proxy ( content => template($hy_backendrule), order => $backend_order, } + } diff --git a/templates/haproxy_tail.erb b/templates/haproxy_tail.erb new file mode 100644 index 0000000..a41d808 --- /dev/null +++ b/templates/haproxy_tail.erb @@ -0,0 +1,4 @@ + +backend error_backend + mode http + errorfile 503 /etc/haproxy/errors/503.http