adds haproxy user
This commit is contained in:
@@ -87,8 +87,8 @@ All files and directories are configured with correct selinux context. If selinu
|
||||
### Known Problems
|
||||
|
||||
### Support
|
||||
* OS: CentOS 6, 7
|
||||
* Puppet 3.x
|
||||
* OS: CentOS 7
|
||||
* Puppet 5.x
|
||||
|
||||
|
||||
### Tests
|
||||
|
||||
@@ -28,28 +28,16 @@ class cd_haproxy::firewall::iptables (
|
||||
|
||||
require cd_haproxy::main::files
|
||||
|
||||
if $hy_proxy_mode == 'http' {
|
||||
|
||||
firewall { "${hy_fw_order_no}80 tcp port 80":
|
||||
firewall { "${hy_fw_order_no}${hy_http_port} tcp port ${hy_http_port}":
|
||||
proto => 'tcp',
|
||||
dport => '80',
|
||||
dport => $hy_http_port,
|
||||
action => 'accept',
|
||||
}
|
||||
}
|
||||
|
||||
if $hy_proxy_mode == 'tcp' {
|
||||
|
||||
firewall { "${hy_fw_order_no}${hy_fe_port} tcp port ${hy_fe_port}":
|
||||
firewall { "${hy_fw_order_no}${hy_https_port} tcp port ${hy_https_port}":
|
||||
proto => 'tcp',
|
||||
dport => $hy_fe_port,
|
||||
dport => $hy_https_port,
|
||||
action => 'accept',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if $fqdn == $hy_host_fqdn {
|
||||
|
||||
require cd_haproxy::main::files
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ class cd_haproxy::main::config (
|
||||
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
require cd_haproxy::server::service
|
||||
include cd_haproxy::server::service
|
||||
|
||||
}
|
||||
|
||||
@@ -25,9 +25,7 @@ class cd_haproxy::main::dirs (
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
if $fqdn == $hy_host_fqdn {
|
||||
|
||||
require cd_haproxy::main::install
|
||||
|
||||
require cd_haproxy::main::user
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@ class cd_haproxy::main::files (
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
if $fqdn == $hy_host_fqdn {
|
||||
|
||||
require cd_haproxy::main::dirs
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ class cd_haproxy::main::install (
|
||||
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
if $fqdn == $hy_host_fqdn {
|
||||
package {$reqpackages:
|
||||
ensure => $pkg_ensure,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
48
manifests/main/user.pp
Normal file
48
manifests/main/user.pp
Normal file
@@ -0,0 +1,48 @@
|
||||
## cd_haproxy::main::user.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 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 <http://www.gnu.org/licenses/>.
|
||||
# @summary Class manages service users for cd_haproxy.
|
||||
#############################################################################
|
||||
class cd_haproxy::main::user (
|
||||
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
if $fqdn == $hy_host_fqdn {
|
||||
require cd_haproxy::main::install
|
||||
|
||||
# manage user
|
||||
user { $hy_user:
|
||||
ensure => present,
|
||||
name => $hy_user,
|
||||
allowdupe => false,
|
||||
comment => $hy_user_comment,
|
||||
gid => $hy_user,
|
||||
managehome => true,
|
||||
home => $hy_user_home,
|
||||
shell => $hy_user_shell,
|
||||
}
|
||||
|
||||
group { $hy_user:
|
||||
ensure => present,
|
||||
name => $hy_user,
|
||||
allowdupe => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,16 +49,24 @@ $hy_manage_fw = true,
|
||||
$hy_fw_order_no = '50',
|
||||
|
||||
# main config
|
||||
$hy_proxy_mode = 'http',
|
||||
$hy_fe_port = '',
|
||||
$hy_be_port = '',
|
||||
$hy_http_port = '80',
|
||||
$hy_https_port = '443',
|
||||
|
||||
# user
|
||||
$hy_user_name = 'haproxy',
|
||||
$hy_user_comment = 'haproxy user',
|
||||
$hy_user_home = '/var/lib/haproxy',
|
||||
$hy_user_shell = '/sbin/nologin',
|
||||
|
||||
) {
|
||||
|
||||
# service
|
||||
$hy_service = 'haproxy'
|
||||
|
||||
# installation section
|
||||
# directories
|
||||
|
||||
|
||||
# files
|
||||
|
||||
|
||||
# includes must be last
|
||||
|
||||
27
manifests/server/proxy.pp
Normal file
27
manifests/server/proxy.pp
Normal file
@@ -0,0 +1,27 @@
|
||||
## cd_haproxy::server::proxy.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 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 <http://www.gnu.org/licenses/>.
|
||||
# @summary Define manages the proxies for cd_haproxy.
|
||||
#############################################################################
|
||||
define cd_haproxy::server::proxy (
|
||||
|
||||
) {
|
||||
|
||||
}
|
||||
85
templates/haproxy.cfg
Normal file
85
templates/haproxy.cfg
Normal file
@@ -0,0 +1,85 @@
|
||||
#---------------------------------------------------------------------
|
||||
# Example configuration for a possible web application. See the
|
||||
# full configuration options online.
|
||||
#
|
||||
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Global settings
|
||||
#---------------------------------------------------------------------
|
||||
global
|
||||
# to have these messages end up in /var/log/haproxy.log you will
|
||||
# need to:
|
||||
#
|
||||
# 1) configure syslog to accept network log events. This is done
|
||||
# by adding the '-r' option to the SYSLOGD_OPTIONS in
|
||||
# /etc/sysconfig/syslog
|
||||
#
|
||||
# 2) configure local2 events to go to the /var/log/haproxy.log
|
||||
# file. A line like the following can be added to
|
||||
# /etc/sysconfig/syslog
|
||||
#
|
||||
# local2.* /var/log/haproxy.log
|
||||
#
|
||||
log 127.0.0.1 local2
|
||||
|
||||
chroot /var/lib/haproxy
|
||||
pidfile /var/run/haproxy.pid
|
||||
maxconn 4000
|
||||
user haproxy
|
||||
group haproxy
|
||||
daemon
|
||||
|
||||
# turn on stats unix socket
|
||||
stats socket /var/lib/haproxy/stats
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# common defaults that all the 'listen' and 'backend' sections will
|
||||
# use if not designated in their block
|
||||
#---------------------------------------------------------------------
|
||||
defaults
|
||||
mode http
|
||||
log global
|
||||
option httplog
|
||||
option dontlognull
|
||||
option http-server-close
|
||||
option forwardfor except 127.0.0.0/8
|
||||
option redispatch
|
||||
retries 3
|
||||
timeout http-request 10s
|
||||
timeout queue 1m
|
||||
timeout connect 10s
|
||||
timeout client 1m
|
||||
timeout server 1m
|
||||
timeout http-keep-alive 10s
|
||||
timeout check 10s
|
||||
maxconn 3000
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# main frontend which proxys to the backends
|
||||
#---------------------------------------------------------------------
|
||||
frontend main *:5000
|
||||
acl url_static path_beg -i /static /images /javascript /stylesheets
|
||||
acl url_static path_end -i .jpg .gif .png .css .js
|
||||
|
||||
use_backend static if url_static
|
||||
default_backend app
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# static backend for serving up images, stylesheets and such
|
||||
#---------------------------------------------------------------------
|
||||
backend static
|
||||
balance roundrobin
|
||||
server static 127.0.0.1:4331 check
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# round robin balancing between the various backends
|
||||
#---------------------------------------------------------------------
|
||||
backend app
|
||||
balance roundrobin
|
||||
server app1 127.0.0.1:5001 check
|
||||
server app2 127.0.0.1:5002 check
|
||||
server app3 127.0.0.1:5003 check
|
||||
server app4 127.0.0.1:5004 check
|
||||
Reference in New Issue
Block a user