Skip to content

Commit

Permalink
Allow the contents of /etc/default/haproxy to be overridden
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidS committed Aug 27, 2015
1 parent d657ec2 commit 14540d0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ Main class, includes all other classes.

* `service_manage`: Specifies whether the state of the HAProxy service should be managed by Puppet. Valid options: 'true' and 'false'. Default: 'true'.

* `service_options`: Contents for the `/etc/defaults/haproxy` file on Debian. Defaults to "ENABLED=1\n" on Debian, and is ignored on other systems.

#### Define: `haproxy::balancermember`

Configures a service inside a listening or backend service configuration block in haproxy.cfg.
Expand Down Expand Up @@ -529,4 +531,4 @@ Puppet Labs modules on the Puppet Forge are open projects, and community contrib

For more information, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html)

To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-haproxy/graphs/contributors)
To see who's already involved, see the [list of contributors.](https://github.com/puppetlabs/puppetlabs-haproxy/graphs/contributors)
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
# [*service_manage*]
# Chooses whether the haproxy service state should be managed by puppet at all. Defaults to true
#
# [*service_options*]
# Contents for the `/etc/defaults/haproxy` file on Debian. Defaults to "ENABLED=1\n" on Debian, and is ignored on other systems.
#
# [*global_options*]
# A hash of all the haproxy global options. If you want to specify more
# than one option (i.e. multiple timeout or stats options), pass those
Expand Down Expand Up @@ -83,6 +86,7 @@
$package_name = $haproxy::params::package_name,
$service_ensure = 'running',
$service_manage = true,
$service_options = "ENABLED=1\n",
$global_options = $haproxy::params::global_options,
$defaults_options = $haproxy::params::defaults_options,
$restart_command = undef,
Expand All @@ -101,6 +105,7 @@
}
validate_string($package_name,$package_ensure)
validate_bool($service_manage)
validate_string($service_options)

# To support deprecating $enable
if $enable != undef {
Expand Down
2 changes: 1 addition & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
if $haproxy::_service_manage {
if ($::osfamily == 'Debian') {
file { '/etc/default/haproxy':
content => 'ENABLED=1',
content => $haproxy::service_options,
before => Service['haproxy'],
}
}
Expand Down

0 comments on commit 14540d0

Please sign in to comment.