Skip to content

Commit 24049ec

Browse files
authored
Merge pull request #506 from tuxmea/manage_conf_dir
[MODULES-11274] Allow usage of parameter manage_config_dir
2 parents 3382ddf + 2e866ba commit 24049ec

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ node 'haproxy-server' {
4141
include ::haproxy
4242
haproxy::listen { 'puppet00':
4343
collect_exported => false,
44-
ipaddress => $::ipaddress,
44+
ipaddress => $facts['networking']['ip'],
4545
ports => '8140',
4646
}
4747
haproxy::balancermember { 'server00':
@@ -70,7 +70,7 @@ The main [`haproxy` class](#class-haproxy) has many options for configuring your
7070
~~~puppet
7171
class { 'haproxy':
7272
global_options => {
73-
'log' => "${::ipaddress} local0",
73+
'log' => "${facts['networking']['ip']} local0",
7474
'chroot' => '/var/lib/haproxy',
7575
'pidfile' => '/var/run/haproxy.pid',
7676
'maxconn' => '4000',
@@ -151,7 +151,7 @@ To export the resource for a balancermember and collect it on a single HAProxy l
151151

152152
~~~puppet
153153
haproxy::listen { 'puppet00':
154-
ipaddress => $::ipaddress,
154+
ipaddress => $facts['networking']['ip'],
155155
ports => '8140',
156156
mode => 'tcp',
157157
options => {
@@ -195,8 +195,8 @@ First export the resource for a balancermember:
195195
@@haproxy::balancermember { 'haproxy':
196196
listening_service => 'puppet00',
197197
ports => '8140',
198-
server_names => $::hostname,
199-
ipaddresses => $::ipaddress,
198+
server_names => $facts['networking']['hostname'],
199+
ipaddresses => $facts['networking']['ip'],
200200
options => 'check',
201201
}
202202
~~~
@@ -229,16 +229,16 @@ Install and configure an HAProxy service listening on port 8140 and balanced aga
229229
node 'haproxy-server' {
230230
include ::haproxy
231231
haproxy::listen { 'puppet00':
232-
ipaddress => $::ipaddress,
232+
ipaddress => $facts['networking']['ip'],
233233
ports => '8140',
234234
}
235235
}
236236
237237
node /^server\d+/ {
238-
@@haproxy::balancermember { $::fqdn:
238+
@@haproxy::balancermember { $facts['networking']['fqdn']:
239239
listening_service => 'puppet00',
240-
server_names => $::hostname,
241-
ipaddresses => $::ipaddress,
240+
server_names => $facts['networking']['hostname'],
241+
ipaddresses => $facts['networking']['ip'],
242242
ports => '8140',
243243
options => 'check',
244244
}
@@ -253,7 +253,7 @@ This example routes traffic from port 8140 to all balancermembers added to a bac
253253

254254
~~~puppet
255255
haproxy::frontend { 'puppet00':
256-
ipaddress => $::ipaddress,
256+
ipaddress => $facts['networking']['ip'],
257257
ports => '8140',
258258
mode => 'tcp',
259259
bind_options => 'accept-proxy',
@@ -272,7 +272,7 @@ If option order is important, pass an array of hashes to the `options` parameter
272272

273273
~~~puppet
274274
haproxy::frontend { 'puppet00':
275-
ipaddress => $::ipaddress,
275+
ipaddress => $facts['networking']['ip'],
276276
ports => '8140',
277277
mode => 'tcp',
278278
bind_options => 'accept-proxy',
@@ -397,7 +397,7 @@ class and uses `haproxy::instance` to add an additional instance called
397397
haproxy::listen { 'puppet00':
398398
instance => 'haproxy',
399399
collect_exported => false,
400-
ipaddress => $::ipaddress,
400+
ipaddress => $facts['networking']['ip'],
401401
ports => '8800',
402402
}
403403
@@ -411,7 +411,7 @@ class and uses `haproxy::instance` to add an additional instance called
411411
haproxy::listen { 'puppet00':
412412
instance => 'beta',
413413
collect_exported => false,
414-
ipaddress => $::ipaddress,
414+
ipaddress => $facts['networking']['ip'],
415415
ports => '9900',
416416
}
417417
~~~
@@ -430,7 +430,7 @@ The second uses a custom package.
430430
section_name => 'puppet00',
431431
instance => 'group1',
432432
collect_exported => false,
433-
ipaddress => $::ipaddress,
433+
ipaddress => $facts['networking']['ip'],
434434
ports => '8800',
435435
}
436436
haproxy::instance { 'group2': }
@@ -444,7 +444,7 @@ The second uses a custom package.
444444
section_name => 'puppet00',
445445
instance => 'group2',
446446
collect_exported => false,
447-
ipaddress => $::ipaddress,
447+
ipaddress => $facts['networking']['ip'],
448448
ports => '9900',
449449
}
450450
~~~

manifests/config.pp

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$config_dir = undef, # A default is required for Puppet 2.7 compatibility. When 2.7 is no longer supported, this parameter default should be removed.
1313
$custom_fragment = undef, # A default is required for Puppet 2.7 compatibility. When 2.7 is no longer supported, this parameter default should be removed.
1414
$merge_options = $haproxy::merge_options,
15-
$config_validate_cmd = $haproxy::config_validate_cmd
15+
$config_validate_cmd = $haproxy::config_validate_cmd,
1616
# lint:endignore
1717
) {
1818
if $caller_module_name != $module_name {
@@ -28,7 +28,12 @@
2828
warning("${module_name}: The \$merge_options parameter will default to true in the next major release. Please review the documentation regarding the implications.") # lint:ignore:140chars
2929
}
3030

31-
if $haproxy::params::manage_config_dir {
31+
if defined(Class['haproxy']) {
32+
$manage_config_dir = $haproxy::manage_config_dir
33+
} else {
34+
$manage_config_dir = $haproxy::params::manage_config_dir
35+
}
36+
if $manage_config_dir {
3237
if $config_dir != undef {
3338
file { $config_dir:
3439
ensure => directory,

0 commit comments

Comments
 (0)