creates the main conffig target and header

This commit is contained in:
Arne Teuke
2018-12-10 15:56:28 +01:00
parent 2f3afa420b
commit e64adc8f82
6 changed files with 58 additions and 19 deletions

View File

@@ -32,12 +32,15 @@
### Features ### Features
INSTALLATION INSTALLATION
* install binaries * install rpm binaries
CONFIGURATION CONFIGURATION
* manage haproxy user
* manage directories (file system permissions, selinux context)
* manage files (file system permissions, content, selinux context)
SERVICE SERVICE
* manage service * manage haproxy service
### Repo Structure ### Repo Structure
Repostructure has moved to REPOSTRUCTURE.md in repo. Repostructure has moved to REPOSTRUCTURE.md in repo.
@@ -49,7 +52,7 @@ See the full Puppet documentation in docs/index.html
All dependencies must be included in the catalogue. All dependencies must be included in the catalogue.
* [cd_resources](https://gitlab.confdroid.com/12WW1160/cd_resources) for managing yum base repos * [cd_resources](https://gitlab.confdroid.com/12WW1160/cd_resources) for managing yum base repos
* [cd_certbot](https://gitlab.confdroid.com/12WW1160/certbot) for automating TLS certificates for https * [cd_concat](https://gitlab.confdroid.com/12ww1160/cd_concat) or [concat](https://github.com/puppetlabs/puppetlabs-concat) for managing file fragments
### Deployment ### Deployment

View File

@@ -26,7 +26,17 @@ class cd_haproxy::main::dirs (
if $fqdn == $hy_host_fqdn { if $fqdn == $hy_host_fqdn {
require cd_haproxy::main::user 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,
}
} }
} }

View File

@@ -26,5 +26,24 @@ class cd_haproxy::main::files (
if $fqdn == $hy_host_fqdn { if $fqdn == $hy_host_fqdn {
require cd_haproxy::main::dirs 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,
}
# create the header
concat::fragment { 'header':
target => $hy_main_config,
content => $hy_config_head_erb,
order => '001',
}
} }
} }

View File

@@ -39,34 +39,36 @@
############################################################################## ##############################################################################
class cd_haproxy::params ( class cd_haproxy::params (
$pkg_ensure = 'latest', $pkg_ensure = 'latest',
$reqpackages = ['haproxy'], $reqpackages = ['haproxy'],
$hy_host_fqdn = "proxy.${::domain}", $hy_host_fqdn = "proxy.${::domain}",
# firewall # firewall
$hy_manage_fw = true, $hy_manage_fw = true,
$hy_fw_order_no = '50', $hy_fw_order_no = '50',
# main config # main config
$hy_http_port = '80', $hy_http_port = '80',
$hy_https_port = '443', $hy_https_port = '443',
# user # user
$hy_user_name = 'haproxy', $hy_user_name = 'haproxy',
$hy_user_comment = 'haproxy user', $hy_user_comment = 'haproxy user',
$hy_user_home = '/var/lib/haproxy', $hy_user_home = '/var/lib/haproxy',
$hy_user_shell = '/sbin/nologin', $hy_user_shell = '/sbin/nologin',
) { ) {
# service # service
$hy_service = 'haproxy' $hy_service = 'haproxy'
# directories # directories
$hy_main_dir = '/etc/haproxy'
# files # files
$hy_main_config = "${hy_main_dir}/haproxy.cfg"
$hy_config_head_erb = 'cd_puppet/haproxy_head.erb'
# includes must be last # includes must be last

View File

@@ -1,4 +1,4 @@
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Example configuration for a possible web application. See the # Example configuration for a possible web application. See the
# full configuration options online. # full configuration options online.
# #

View File

@@ -0,0 +1,5 @@
###############################################################################
##### haproxy.cfg created by puppet through concatenation. manual changes #####
##### will be overwritten. original full file available at #####
##### https://confdroid.com/2018/12/haproxy-cfg/ #####
###############################################################################