inital commit
This commit is contained in:
55
manifests/firewall/iptables.pp
Normal file
55
manifests/firewall/iptables.pp
Normal file
@@ -0,0 +1,55 @@
|
||||
## cd_haproxy::firewall::iptables.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 <http://www.gnu.org/licenses/>.
|
||||
# @summary manage firewall settings through cd_firewall or puppetlabs-firewall
|
||||
###############################################################################
|
||||
class cd_haproxy::firewall::iptables (
|
||||
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
if ($fqdn == $hy_host_fqdn) and ($hy_manage_fw == true) {
|
||||
|
||||
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',
|
||||
}
|
||||
}
|
||||
|
||||
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',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if $fqdn == $hy_host_fqdn {
|
||||
|
||||
require cd_haproxy::main::files
|
||||
|
||||
}
|
||||
}
|
||||
25
manifests/init.pp
Normal file
25
manifests/init.pp
Normal file
@@ -0,0 +1,25 @@
|
||||
## cd_haproxy::init.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 <http://www.gnu.org/licenses/>.
|
||||
# @summary Class initializes the cd_haproxy module.
|
||||
##############################################################################
|
||||
class cd_haproxy {
|
||||
include cd_haproxy::params
|
||||
}
|
||||
30
manifests/main/config.pp
Normal file
30
manifests/main/config.pp
Normal file
@@ -0,0 +1,30 @@
|
||||
## cd_haproxy::main::config.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 <http://www.gnu.org/licenses/>.
|
||||
# @summary Class manages all aspects of configuring the module logic for
|
||||
# cd_haproxy.
|
||||
##############################################################################
|
||||
class cd_haproxy::main::config (
|
||||
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
require cd_haproxy::server::service
|
||||
|
||||
}
|
||||
34
manifests/main/dirs.pp
Normal file
34
manifests/main/dirs.pp
Normal file
@@ -0,0 +1,34 @@
|
||||
## cd_haproxy::main::dirs.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 <http://www.gnu.org/licenses/>.
|
||||
# @summary Class manages all directories required for cd_haproxy.
|
||||
###############################################################################
|
||||
class cd_haproxy::main::dirs (
|
||||
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
if $fqdn == $hy_host_fqdn {
|
||||
|
||||
require cd_haproxy::main::install
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
32
manifests/main/files.pp
Normal file
32
manifests/main/files.pp
Normal file
@@ -0,0 +1,32 @@
|
||||
## cd_haproxy::main::files.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 <http://www.gnu.org/licenses/>.
|
||||
# @summary Class manages all configuration files required for cd_haproxy.
|
||||
##############################################################################
|
||||
class cd_haproxy::main::files (
|
||||
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
if $fqdn == $hy_host_fqdn {
|
||||
|
||||
require cd_haproxy::main::dirs
|
||||
|
||||
}
|
||||
}
|
||||
31
manifests/main/install.pp
Normal file
31
manifests/main/install.pp
Normal file
@@ -0,0 +1,31 @@
|
||||
## cd_haproxy::main::install.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 <http://www.gnu.org/licenses/>.
|
||||
# @summary Class manage all aspects of installing binaries required for
|
||||
# cd_haproxy
|
||||
###############################################################################
|
||||
class cd_haproxy::main::install (
|
||||
|
||||
) inherits cd_haproxy::params {
|
||||
|
||||
package {$reqpackages:
|
||||
ensure => $pkg_ensure,
|
||||
}
|
||||
}
|
||||
66
manifests/params.pp
Normal file
66
manifests/params.pp
Normal file
@@ -0,0 +1,66 @@
|
||||
## 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 <http://www.gnu.org/licenses/>.
|
||||
# @summary Class holds all parameters for the cd_haproxy module and is
|
||||
# inherited by all classes except defines.
|
||||
# @param [string] pkg_ensure
|
||||
# which [package type](https://confdroid.com/2017/05/puppet-type-package/)
|
||||
# to choose, i.e. `latest` or `present`.
|
||||
# @param [string] reqpackages specify th epackages to be installed
|
||||
# @param [string] hy_host_fqdn the fqdn of the ha proxy host. mmust be fqdn,
|
||||
# not cname. specify multiple fqdns via array.
|
||||
# @param [boolean] hy_manage_fw whether to manage the firewall.
|
||||
# @param [string] hy_fw_order_no the rule number to control the oder of the
|
||||
# firewall rules.
|
||||
# @param [string] hy_proxy_mode which mode the ha proxy should work in.
|
||||
# Valid oprtions are `http` and `tcp`.
|
||||
# @param [string] hy_fe_port the frontend port to list to. opens in firewall,
|
||||
# if enabled, and is used in configuration templates. only active if
|
||||
# `hy_proxy_mode` is set to `tcp`.
|
||||
# @param [string] hy_be_port the backend port to send traffic through. only
|
||||
# active if `hy_proxy_mode` is set to `tcp`.
|
||||
##############################################################################
|
||||
class cd_haproxy::params (
|
||||
|
||||
$pkg_ensure = 'latest',
|
||||
$reqpackages = ['haproxy'],
|
||||
|
||||
$hy_host_fqdn = "proxy.${::domain}",
|
||||
|
||||
# firewall
|
||||
$hy_manage_fw = true,
|
||||
$hy_fw_order_no = '50',
|
||||
|
||||
# main config
|
||||
$hy_proxy_mode = 'http',
|
||||
$hy_fe_port = '',
|
||||
$hy_be_port = '',
|
||||
|
||||
) {
|
||||
|
||||
# service
|
||||
$hy_service = 'haproxy'
|
||||
|
||||
# installation section
|
||||
|
||||
|
||||
# includes must be last
|
||||
|
||||
}
|
||||
38
manifests/server/service.pp
Normal file
38
manifests/server/service.pp
Normal file
@@ -0,0 +1,38 @@
|
||||
## cd_haproxy::server::service.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 <http://www.gnu.org/licenses/>.
|
||||
# @summary Class manages the service(s) for cd_haproxy.
|
||||
#############################################################################
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user