Documentation by YARD 0.9.26
-Alphabetic Index
- -Puppet Class Listing A-Z
- - -
-
-
-
|
-
Defined Type Listing A-Z
- - -
-
-
-
|
-
File Listing
--
-
-
-
- README - - -
diff --git a/Jenkinsfile b/Jenkinsfile index 0c64627..7d42574 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,16 +51,9 @@ pipeline { stage('puppet-lint') { steps { - sh '''find . -iname *.pp -exec /usr/local/rvm/gems/ruby-2.5.0/wrappers/puppet-lint \\ - --no-class_inherits_from_params_class-check \\ - --no-variable_scope-check \\ - --no-80chars-check \\ - --no-arrow_alignment-check \\ - --no-autoloader_layout-check \\ - --no-140chars-check \\ - --log-format "%{path}:%{line}:%{check}:%{KIND}:%{message}" {} \\; + sh '''/usr/local/bin/puppet-lint . \\ + --no-variable_scope-check \\ ''' - recordIssues aggregatingResults: true, tool: puppetLint() } } diff --git a/README.md b/README.md index 802b3ed..297102d 100644 --- a/README.md +++ b/README.md @@ -100,10 +100,7 @@ All files and directories are configured with correct selinux context. If selinu * Puppet Lint * excluded tests: - * `--no-class_inherits_from_params_class-check`:relevant only to non-supported outdated puppet versions * `--no-variable_scope-check`: not applicable as we are inheriting parameters from params class. the lint check does not distinguish between facts and inherited parameters. - * `--no-80chars-check`: it is not always possible to stay within 80 characters, although typically only occurring on the parameter vault `params.pp`. - * `--no-arrow_alignment-check`: this check leads to actually not having am easily readable arrow alignment, as this checks `per block`, not per class. * Puppet Parser * ERB Template Parser * Sonar Quality Gate diff --git a/doc/_index.html b/doc/_index.html deleted file mode 100644 index 8d01c37..0000000 --- a/doc/_index.html +++ /dev/null @@ -1,182 +0,0 @@ - - -
- - -
-
-
-
|
-
-
-
-
|
-
| t |
- - - -23 -24 -25- |
-
- # File 'manifests/init.pp', line 23
-
-class cd_haproxy {
- include cd_haproxy::params
-}
- |
-
cd_haproxy::firewall::iptables.pp Module name: cd_haproxy Author: Arne -Teuke (arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26- |
-
- # File 'manifests/firewall/iptables.pp', line 6
-
-class cd_haproxy::firewall::iptables (
-
-) inherits cd_haproxy::params {
-
- if ($fqdn == $hy_host_fqdn) and ($hy_manage_fw == true) {
-
- require cd_haproxy::main::files
-
- firewall { "${hy_fw_order_no}${hy_http_port} tcp port ${hy_http_port}":
- proto => 'tcp',
- dport => $hy_http_port,
- jump => 'accept',
- }
-
- firewall { "${hy_fw_order_no}${hy_https_port} tcp port ${hy_https_port}":
- proto => 'tcp',
- dport => $hy_https_port,
- jump => 'accept',
- }
- }
-}
- |
-
cd_haproxy::main::config.pp Module name: cd_haproxy Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18- |
-
- # File 'manifests/main/config.pp', line 7
-
-class cd_haproxy::main::config (
-
-) inherits cd_haproxy::params {
-
- include cd_haproxy::server::service
-
- if $hy_manage_fail2ban == true {
-
- include cd_haproxy::monitoring::fail2ban
-
- }
-}
- |
-
cd_haproxy::main::dirs.pp Module name: cd_haproxy Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37- |
-
- # File 'manifests/main/dirs.pp', line 6
-
-class cd_haproxy::main::dirs (
-
-) inherits cd_haproxy::params {
-
- if $fqdn == $hy_host_fqdn {
- require cd_haproxy::main::user
-
- # main dir
- file { $hy_main_dir:
- ensure => directory,
- owner => 'root',
- group => 'root',
- mode => '0755',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- }
-
- # errors dir
- file { $hy_errors_dir:
- ensure => directory,
- owner => 'root',
- group => 'root',
- mode => '0755',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- }
- }
-}
- |
-
cd_haproxy::main::files.pp Module name: cd_haproxy Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161- |
-
- # File 'manifests/main/files.pp', line 6
-
-class cd_haproxy::main::files (
-
-) inherits cd_haproxy::params {
-
- if $fqdn == $hy_host_fqdn {
- require cd_haproxy::main::dirs
-
- # create the concat target
- concat {$hy_main_config:
- ensure => present,
- owner => 'root',
- group => 'root',
- mode => '0640',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- notify => Service[$hy_service],
- }
-
- # create the header
- concat::fragment { 'header':
- target => $hy_main_config,
- content => template($hy_config_head_erb),
- 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,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => haproxy_var_run_t,
- seluser => system_u,
- }
-
- # error files
- file { $hy_400_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_400_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_403_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_403_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_408_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_408_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_500_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_500_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_502_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_502_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_503_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_503_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_504_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_504_erb),
- notify => Service[$hy_service],
- }
-
- # make sure rsyslog is logging haproxy logs
-
- file { '/etc/rsyslog.d/10-haproxy.conf':
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => syslog_conf_t,
- seluser => system_u,
- content => template('cd_haproxy/rsyslog/10_haproxy.conf.erb'),
-# notify => Service['rsyslog'], # only if using cd_rsyslog
- }
- }
-}
- |
-
cd_haproxy::main::install.pp Module name: cd_haproxy Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -7 -8 -9 -10 -11 -12 -13 -14 -15 -16- |
-
- # File 'manifests/main/install.pp', line 7
-
-class cd_haproxy::main::install (
-
-) inherits cd_haproxy::params {
-
- if $fqdn == $hy_host_fqdn {
- package {$reqpackages:
- ensure => $pkg_ensure,
- }
- }
-}
- |
-
cd_haproxy::main::user.pp Module name: cd_haproxy Author: Arne Teuke -(arne_teuke@ConfDroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31- |
-
- # File 'manifests/main/user.pp', line 6
-
-class cd_haproxy::main::user (
-
-) inherits cd_haproxy::params {
-
- if $fqdn == $hy_host_fqdn {
- require cd_haproxy::main::install
-
- # manage user
- user { $hy_user_name:
- ensure => present,
- name => $hy_user_name,
- allowdupe => false,
- comment => $hy_user_comment,
- gid => $hy_user_name,
- managehome => true,
- home => $hy_user_home,
- shell => $hy_user_shell,
- }
-
- group { $hy_user_name:
- ensure => present,
- name => $hy_user_name,
- allowdupe => false,
- }
- }
-}
- |
-
Module name: cd_haproxy Author: Arne Teuke (arne_teuke@confdroid.com)
- -
- - - -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41- |
-
- # File 'manifests/monitoring/fail2ban.pp', line 5
-
-class cd_haproxy::monitoring::fail2ban (
-
-) inherits cd_haproxy::params {
-
- if $hy_manage_fail2ban == true {
-
- require cd_fail2ban
-
- # configure filter
-
- file { '/etc/fail2ban/filter.d/haproxy.conf':
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template('cd_haproxy/fail2ban/f2b_haproxy.conf.erb'),
- notify => Service['fail2ban'],
- }
-
- file { '/etc/fail2ban/jail.d/010-haproxy.conf':
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template('cd_haproxy/fail2ban/010_jail.d_haproxy.conf.erb'),
- notify => Service['fail2ban'],
- }
- }
-}
- |
-
cd_haproxy::params.pp Module name: cd_haproxy Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145- |
-
- # File 'manifests/params.pp', line 58
-
-class cd_haproxy::params (
-
-$pkg_ensure = 'latest',
-$reqpackages = ['haproxy','httpd-tools'],
-
-$hy_host_fqdn = undef,
-
-# firewall
-$hy_manage_fw = true,
-$hy_fw_order_no = '50',
-
-# fail2ban
-$hy_manage_fail2ban = false,
-
-# main config
-$hy_http_port = '80',
-$hy_https_port = '443',
-$hy_chroot = '/var/lib/haproxy',
-$hy_pid = '/var/run/haproxy.pid',
-$hy_maxconn = '4000',
-$hy_show_stats = false,
-$hy_stats_socket = '/var/lib/haproxy/stats',
-$hy_default_mode = 'tcp',
-$hy_use_http_server_close = false,
-$hy_use_forward_for = false,
-$hy_use_redispatch = true,
-$hy_max_retries = '3',
-$hy_timeout_http_request = '10s',
-$hy_timeout_queue = '1m',
-$hy_timeout_connect = '10s',
-$hy_timeout_client = '1m',
-$hy_timeout_server = '1m',
-$hy_timeout_http_keep_alive = '10s',
-$hy_timeout_check = '10s',
-$hy_hard_stop = true,
-$hy_hard_stop_value = '60s',
-
-# user
-$hy_user_name = 'haproxy',
-$hy_user_comment = 'haproxy user',
-$hy_user_home = '/var/lib/haproxy',
-$hy_user_shell = '/sbin/nologin',
-
-# logging
-$hy_log_local0 = '127.0.0.1:514 local0',
-$hy_log_local1 = '127.0.0.1:514 local1 notice',
-$hy_log_target = '127.0.0.1',
-$hy_log_facility = 'local2',
-$hy_log_default = 'global',
-$hy_use_tcplog = true,
-$hy_use_httplog = false,
-$hy_use_dontlognull = true,
-$hy_manage_be_users = false,
-$hy_be_userlist = '####',
-
-) {
-
-# service
-$hy_service = 'haproxy'
-
-# directories
-$hy_main_dir = '/etc/haproxy'
-$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"
-$hy_403_erb = 'cd_haproxy/errors/403_http.erb'
-$hy_408_file = "${hy_errors_dir}/408.http"
-$hy_408_erb = 'cd_haproxy/errors/408_http.erb'
-$hy_500_file = "${hy_errors_dir}/500.http"
-$hy_500_erb = 'cd_haproxy/errors/500_http.erb'
-$hy_502_file = "${hy_errors_dir}/502.http"
-$hy_502_erb = 'cd_haproxy/errors/502_http.erb'
-$hy_503_file = "${hy_errors_dir}/503.http"
-$hy_503_erb = 'cd_haproxy/errors/503_http.erb'
-$hy_504_file = "${hy_errors_dir}/504.http"
-$hy_504_erb = 'cd_haproxy/errors/504_http.erb'
-
-# includes must be last
-
- include cd_haproxy::main::config
-
-}
- |
-
cd_haproxy::server::proxy_test.pp Module name: cd_haproxy Author: Arne -Teuke (arne_teuke@ConfDroid.com)
- -This file is part of cd_haproxy.
- -cd_haproxy is used for providing automatic configuration of HAProxy -Copyright (C) 2016 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 www.gnu.org/licenses/.
- -
- - - -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39- |
-
- # File 'manifests/server/proxy_test.pp', line 23
-
-class cd_haproxy::server::proxy_test (
-
-) inherits cd_haproxy::params {
-
- cd_haproxy::server::proxy { 'testing':
- haproxy_fqdn => 'pxe703.studydivision.local',
- frontend_name => 'test01-frontend',
- frontend_mode => 'http',
- acl_rule => ['too_fast fe_sess_rate ge 10',
- 'network_allowed src 0.0.0.0/0'],
- fe_maxconn => '10000',
- backend_name => 'test01-backend',
- be_server_name => ['web01 web01.confdroid.com:80 check',
- 'web02 web02.confdroid.com:80 check'],
-
- }
-}
- |
-
cd_haproxy::server::service.pp Module name: cd_haproxy Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21- |
-
- # File 'manifests/server/service.pp', line 6
-
-class cd_haproxy::server::service (
-
-) inherits cd_haproxy::params {
-
- if $fqdn == $hy_host_fqdn {
-
- require cd_haproxy::firewall::iptables
-
- service { $hy_service:
- ensure => running,
- hasstatus => true,
- hasrestart => true,
- enable => true,
- }
- }
-}
- |
-
haproxy_cd::init.pp Module name: haproxy_cd Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -6 -7 -8- |
-
- # File 'manifests/init.pp', line 6
-
-class haproxy_cd {
- include haproxy_cd::params
-}
- |
-
haproxy_cd::firewall::iptables.pp Module name: haproxy_cd Author: Arne -Teuke (arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22- |
-
- # File 'manifests/firewall/iptables.pp', line 6
-
-class haproxy_cd::firewall::iptables (
-
-) inherits haproxy_cd::params {
- if ($fqdn == $hy_host_fqdn) and ($hy_manage_fw == true) {
- firewall { "${hy_fw_order_no}${hy_http_port} tcp port ${hy_http_port}":
- proto => 'tcp',
- dport => $hy_http_port,
- jump => 'accept',
- }
-
- firewall { "${hy_fw_order_no}${hy_https_port} tcp port ${hy_https_port}":
- proto => 'tcp',
- dport => $hy_https_port,
- jump => 'accept',
- }
- }
-}
- |
-
haproxy_cd::main::config.pp Module name: haproxy_cd Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14- |
-
- # File 'manifests/main/config.pp', line 6
-
-class haproxy_cd::main::config (
-
-) inherits haproxy_cd::params {
- include haproxy_cd::server::service
-
- if $hy_manage_fail2ban == true {
- include haproxy_cd::monitoring::fail2ban
- }
-}
- |
-
haproxy_cd::main::dirs.pp Module name: haproxy_cd Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36- |
-
- # File 'manifests/main/dirs.pp', line 6
-
-class haproxy_cd::main::dirs (
-
-) inherits haproxy_cd::params {
- if $fqdn == $hy_host_fqdn {
- require haproxy_cd::main::user
-
- # main dir
- file { $hy_main_dir:
- ensure => directory,
- owner => 'root',
- group => 'root',
- mode => '0755',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- }
-
- # errors dir
- file { $hy_errors_dir:
- ensure => directory,
- owner => 'root',
- group => 'root',
- mode => '0755',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- }
- }
-}
- |
-
haproxy_cd::main::files.pp Module name: haproxy_cd Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158- |
-
- # File 'manifests/main/files.pp', line 6
-
-class haproxy_cd::main::files (
-
-) inherits haproxy_cd::params {
- if $fqdn == $hy_host_fqdn {
- require haproxy_cd::main::dirs
-
- # create the concat target
- concat { $hy_main_config:
- ensure => present,
- owner => 'root',
- group => 'root',
- mode => '0640',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- notify => Service[$hy_service],
- }
-
- # create the header
- concat::fragment { 'header':
- target => $hy_main_config,
- content => template($hy_config_head_erb),
- 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,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => haproxy_var_run_t,
- seluser => system_u,
- }
-
- # error files
- file { $hy_400_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_400_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_403_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_403_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_408_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_408_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_500_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_500_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_502_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_502_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_503_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_503_erb),
- notify => Service[$hy_service],
- }
-
- file { $hy_504_file:
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template($hy_504_erb),
- notify => Service[$hy_service],
- }
-
- # make sure syslog is logging haproxy logs
-
- file { '/etc/rsyslog.d/10-haproxy.conf':
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => syslog_conf_t,
- seluser => system_u,
- content => template('haproxy_cd/rsyslog/10_haproxy.conf.erb'),
-# notify => Service['rsyslog'], # only if using rsyslog_cd module
- }
- }
-}
- |
-
haproxy_cd::main::install.pp Module name: haproxy_cd Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14- |
-
- # File 'manifests/main/install.pp', line 6
-
-class haproxy_cd::main::install (
-
-) inherits haproxy_cd::params {
- if $fqdn == $hy_host_fqdn {
- package { $reqpackages:
- ensure => $pkg_ensure,
- }
- }
-}
- |
-
haproxy_cd::main::user.pp Module name: haproxy_cd Author: Arne Teuke -(arne_teuke@ConfDroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30- |
-
- # File 'manifests/main/user.pp', line 6
-
-class haproxy_cd::main::user (
-
-) inherits haproxy_cd::params {
- if $fqdn == $hy_host_fqdn {
- require haproxy_cd::main::install
-
- # manage user
- user { $hy_user_name:
- ensure => present,
- name => $hy_user_name,
- allowdupe => false,
- comment => $hy_user_comment,
- gid => $hy_user_name,
- managehome => true,
- home => $hy_user_home,
- shell => $hy_user_shell,
- }
-
- group { $hy_user_name:
- ensure => present,
- name => $hy_user_name,
- allowdupe => false,
- }
- }
-}
- |
-
Module name: haproxy_cd Author: Arne Teuke (arne_teuke@confdroid.com)
- -
- - - -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39- |
-
- # File 'manifests/monitoring/fail2ban.pp', line 5
-
-class haproxy_cd::monitoring::fail2ban (
-
-) inherits haproxy_cd::params {
- if $hy_manage_fail2ban == true {
- require fail2ban_cd # (external module)
-
- # configure filter
-
- file { '/etc/fail2ban/filter.d/haproxy.conf':
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template('haproxy_cd/fail2ban/f2b_haproxy.conf.erb'),
- notify => Service['fail2ban'],
- }
-
- file { '/etc/fail2ban/jail.d/010-haproxy.conf':
- ensure => file,
- owner => 'root',
- group => 'root',
- mode => '0644',
- selrange => s0,
- selrole => object_r,
- seltype => etc_t,
- seluser => system_u,
- content => template('haproxy_cd/fail2ban/010_jail.d_haproxy.conf.erb'),
- notify => Service['fail2ban'],
- }
- }
-}
- |
-
haproxy_cd::params.pp Module name: haproxy_cd Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163- |
-
- # File 'manifests/params.pp', line 76
-
-class haproxy_cd::params (
-
- String $pkg_ensure = 'latest',
- Array $reqpackages = ['haproxy','httpd-tools'],
-
- String $hy_host_fqdn = undef,
-
-# firewall
- Boolean $hy_manage_fw = true,
- String $hy_fw_order_no = '50',
-
-# fail2ban
- Boolean $hy_manage_fail2ban = false,
-
-# main config
- String $hy_http_port = '80',
- String $hy_https_port = '443',
- String $hy_chroot = '/var/lib/haproxy',
- String $hy_pid = '/var/run/haproxy.pid',
- String $hy_maxconn = '4000',
- Boolean $hy_show_stats = false,
- String $hy_stats_socket = '/var/lib/haproxy/stats',
- String $hy_default_mode = 'tcp',
- Boolean $hy_use_http_server_close = false,
- Boolean $hy_use_forward_for = false,
- Boolean $hy_use_redispatch = true,
- String $hy_max_retries = '3',
- String $hy_timeout_http_request = '10s',
- String $hy_timeout_queue = '1m',
- String $hy_timeout_connect = '10s',
- String $hy_timeout_client = '1m',
- String $hy_timeout_server = '1m',
- String $hy_timeout_http_keep_alive = '10s',
- String $hy_timeout_check = '10s',
- Boolean $hy_hard_stop = true,
- String $hy_hard_stop_value = '60s',
- String $hy_stats_auth = 'admin:password',
-
-# user
- String $hy_user_name = 'haproxy',
- String $hy_user_comment = 'haproxy user',
- String $hy_user_home = '/var/lib/haproxy',
- String $hy_user_shell = '/sbin/nologin',
-
-# logging
- String $hy_log_local0 = '127.0.0.1:514 local0',
- String $hy_log_local1 = '127.0.0.1:514 local1 notice',
- String $hy_log_target = '127.0.0.1',
- String $hy_log_facility = 'local2',
- String $hy_log_default = 'global',
- Boolean $hy_use_tcplog = true,
- Boolean $hy_use_httplog = false,
- Boolean $hy_use_dontlognull = true,
- Boolean $hy_manage_be_users = false,
- String $hy_be_userlist = '####',
-
-) {
- $fqdn = $facts['networking']['fqdn']
-
- # service
- $hy_service = 'haproxy'
-
- # directories
- $hy_main_dir = '/etc/haproxy'
- $hy_errors_dir = "${hy_main_dir}/errors"
-
- # files
- $hy_main_config = "${hy_main_dir}/haproxy.cfg"
- $hy_config_head_erb = 'haproxy_cd/haproxy_head.erb'
- $hy_config_tail_erb = 'haproxy_cd/haproxy_tail.erb'
- $hy_400_file = "${hy_errors_dir}/400.http"
- $hy_400_erb = 'haproxy_cd/errors/400_http.erb'
- $hy_403_file = "${hy_errors_dir}/403.http"
- $hy_403_erb = 'haproxy_cd/errors/403_http.erb'
- $hy_408_file = "${hy_errors_dir}/408.http"
- $hy_408_erb = 'haproxy_cd/errors/408_http.erb'
- $hy_500_file = "${hy_errors_dir}/500.http"
- $hy_500_erb = 'haproxy_cd/errors/500_http.erb'
- $hy_502_file = "${hy_errors_dir}/502.http"
- $hy_502_erb = 'haproxy_cd/errors/502_http.erb'
- $hy_503_file = "${hy_errors_dir}/503.http"
- $hy_503_erb = 'haproxy_cd/errors/503_http.erb'
- $hy_504_file = "${hy_errors_dir}/504.http"
- $hy_504_erb = 'haproxy_cd/errors/504_http.erb'
-
- # includes must be last
- include haproxy_cd::main::config
-}
- |
-
haproxy_cd::server::service.pp Module name: haproxy_cd Author: Arne Teuke -(arne_teuke@confdroid.com)
- -
- - - -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20- |
-
- # File 'manifests/server/service.pp', line 6
-
-class haproxy_cd::server::service (
-
-) inherits haproxy_cd::params {
- if $fqdn == $hy_host_fqdn {
- require haproxy_cd::firewall::iptables
- require haproxy_cd::main::files
-
- service { $hy_service:
- ensure => running,
- hasstatus => true,
- hasrestart => true,
- enable => true,
- }
- }
-}
- |
-
cd_haproxy::server::proxy.pp Module name: cd_haproxy Author: Arne Teuke -(arne_teuke@ConfDroid.com)
- -
- - - -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89- |
-
- # File 'manifests/server/proxy.pp', line 24
-
-define cd_haproxy::server::proxy (
-
- $haproxy_fqdn = undef,
- $frontend_name = undef,
- $frontend_mode = undef,
- $fe_use_backend = '',
- $fe_bind_mode = undef,
- $fe_option = '',
- $frontend_order = '010',
- $acl_rule_front = '',
- $acl_rule_back = '',
- $backend_name = '',
- $backend_order = '030',
- $fe_maxconn = '',
- $be_server_name = '',
- $be_balance = '',
- $be_mode = '',
- $default_backend = '',
- $be_option = '',
- $fe_tcp_request = '',
- $fe_http_request = '',
- $backend_configs = [],
- $be_stick_table = '',
- $be_stick_on = '',
- $be_http_check = '',
- $be_http_request = '',
- $be_acl_rule = '',
-
-) {
-
- $hy_main_config = '/etc/haproxy/haproxy.cfg'
- $hy_frontendrule = 'cd_haproxy/haproxy_frontend_rule.erb'
- $hy_backendrule = 'cd_haproxy/haproxy_backend_rule.erb'
- $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, ';')
- $fe_use_backend_array = split($fe_use_backend,';')
- $backend_name_array = split($backend_name, ';')
- $be_server_name_array = split($be_server_name, ';')
- $be_option_array = split($be_option, ';')
- $fe_tcp_request_array = split($fe_tcp_request, ';')
- $fe_option_array = split($fe_option, ';')
- $fe_http_request_array = split($fe_http_request, ';')
-
- # create frontend section
- concat::fragment { "frontend_${name}":
- target => $hy_main_config,
- content => template($hy_frontendrule),
- order => $frontend_order,
- }
-
- # Ensure backends are only created once
- ensure_resource('concat::fragment', "backends_${name}", {
- 'target' => $hy_main_config,
- 'content' => template($hy_backendrule),
- 'order' => $backend_order,
- })
-
- # open sepcific firewall ports
-
-
-}
- |
-
haproxy_cd::server::proxy.pp Module name: haproxy_cd Author: Arne Teuke -(arne_teuke@ConfDroid.com)
- -
- - - -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94- |
-
- # File 'manifests/server/proxy.pp', line 34
-
-define haproxy_cd::server::proxy (
-
- String $haproxy_fqdn = undef,
- String $frontend_name = undef,
- String $frontend_mode = undef,
- String $fe_use_backend = '',
- String $fe_bind_mode = undef,
- String $fe_option = '',
- String $frontend_order = '010',
- String $acl_rule_front = '',
- String $acl_rule_back = '',
- String $backend_name = '',
- String $backend_order = '030',
- String $fe_maxconn = '',
- String $be_server_name = '',
- String $be_balance = '',
- String $be_mode = '',
- String $default_backend = '',
- String $be_option = '',
- String $fe_tcp_request = '',
- String $fe_http_request = '',
- Array $backend_configs = [],
- String $be_stick_table = '',
- String $be_stick_on = '',
- String $be_http_check = '',
- String $be_http_request = '',
- String $be_acl_rule = '',
-
-) {
- $hy_main_config = '/etc/haproxy/haproxy.cfg'
- $hy_frontendrule = 'haproxy_cd/haproxy_frontend_rule.erb'
- $hy_backendrule = 'haproxy_cd/haproxy_backend_rule.erb'
- $hy_acl_rule = 'haproxy_cd/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, ';')
- $fe_use_backend_array = split($fe_use_backend,';')
- $backend_name_array = split($backend_name, ';')
- $be_server_name_array = split($be_server_name, ';')
- $be_option_array = split($be_option, ';')
- $fe_tcp_request_array = split($fe_tcp_request, ';')
- $fe_option_array = split($fe_option, ';')
- $fe_http_request_array = split($fe_http_request, ';')
-
- # create frontend section
- concat::fragment { "frontend_${name}":
- target => $hy_main_config,
- content => template($hy_frontendrule),
- order => $frontend_order,
- }
-
- # Ensure backends are only created once
- ensure_resource('concat::fragment', "backends_${name}", {
- 'target' => $hy_main_config,
- 'content' => template($hy_backendrule),
- 'order' => $backend_order,
- })
-
- # open specific firewall ports
-}
- |
-