diff --git a/README.md b/README.md
index 5461262..7652b3a 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/manifests/firewall/iptables.pp b/manifests/firewall/iptables.pp
index 7e553a7..8a08089 100644
--- a/manifests/firewall/iptables.pp
+++ b/manifests/firewall/iptables.pp
@@ -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":
- proto => 'tcp',
- dport => '80',
- action => 'accept',
- }
+ firewall { "${hy_fw_order_no}${hy_http_port} tcp port ${hy_http_port}":
+ proto => 'tcp',
+ dport => $hy_http_port,
+ action => 'accept',
}
- if $hy_proxy_mode == 'tcp' {
-
- firewall { "${hy_fw_order_no}${hy_fe_port} tcp port ${hy_fe_port}":
- proto => 'tcp',
- dport => $hy_fe_port,
- action => 'accept',
- }
+ firewall { "${hy_fw_order_no}${hy_https_port} tcp port ${hy_https_port}":
+ proto => 'tcp',
+ dport => $hy_https_port,
+ action => 'accept',
}
}
-
- if $fqdn == $hy_host_fqdn {
-
- require cd_haproxy::main::files
-
- }
}
diff --git a/manifests/main/config.pp b/manifests/main/config.pp
index 4096782..64ee58a 100644
--- a/manifests/main/config.pp
+++ b/manifests/main/config.pp
@@ -25,6 +25,6 @@ class cd_haproxy::main::config (
) inherits cd_haproxy::params {
- require cd_haproxy::server::service
+ include cd_haproxy::server::service
}
diff --git a/manifests/main/dirs.pp b/manifests/main/dirs.pp
index 75cd825..b7a2638 100644
--- a/manifests/main/dirs.pp
+++ b/manifests/main/dirs.pp
@@ -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
}
diff --git a/manifests/main/files.pp b/manifests/main/files.pp
index 93d32c8..ab41c6a 100644
--- a/manifests/main/files.pp
+++ b/manifests/main/files.pp
@@ -25,8 +25,6 @@ class cd_haproxy::main::files (
) inherits cd_haproxy::params {
if $fqdn == $hy_host_fqdn {
-
require cd_haproxy::main::dirs
-
}
}
diff --git a/manifests/main/install.pp b/manifests/main/install.pp
index 95a2b70..6101927 100644
--- a/manifests/main/install.pp
+++ b/manifests/main/install.pp
@@ -25,7 +25,9 @@ class cd_haproxy::main::install (
) inherits cd_haproxy::params {
- package {$reqpackages:
- ensure => $pkg_ensure,
+ if $fqdn == $hy_host_fqdn {
+ package {$reqpackages:
+ ensure => $pkg_ensure,
+ }
}
}
diff --git a/manifests/main/user.pp b/manifests/main/user.pp
new file mode 100644
index 0000000..db3ea6c
--- /dev/null
+++ b/manifests/main/user.pp
@@ -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 .
+# @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,
+ }
+ }
+}
diff --git a/manifests/params.pp b/manifests/params.pp
index c8c0c69..9c3b866 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -39,26 +39,34 @@
##############################################################################
class cd_haproxy::params (
-$pkg_ensure = 'latest',
-$reqpackages = ['haproxy'],
+$pkg_ensure = 'latest',
+$reqpackages = ['haproxy'],
-$hy_host_fqdn = "proxy.${::domain}",
+$hy_host_fqdn = "proxy.${::domain}",
# firewall
-$hy_manage_fw = true,
-$hy_fw_order_no = '50',
+$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'
+$hy_service = 'haproxy'
-# installation section
+# directories
+
+
+# files
# includes must be last
diff --git a/manifests/server/proxy.pp b/manifests/server/proxy.pp
new file mode 100644
index 0000000..a5cee9b
--- /dev/null
+++ b/manifests/server/proxy.pp
@@ -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 .
+# @summary Define manages the proxies for cd_haproxy.
+#############################################################################
+define cd_haproxy::server::proxy (
+
+) {
+
+}
diff --git a/templates/haproxy.cfg b/templates/haproxy.cfg
new file mode 100644
index 0000000..fc78cb7
--- /dev/null
+++ b/templates/haproxy.cfg
@@ -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