Showing with 200 additions and 70 deletions.
  1. +28 −16 CHANGELOG → CHANGELOG.md
  2. +31 −3 README.md
  3. +26 −7 manifests/frontend.pp
  4. +0 −1 manifests/init.pp
  5. +30 −10 manifests/listen.pp
  6. +5 −11 metadata.json
  7. +0 −2 spec/classes/haproxy_spec.rb
  8. +13 −0 spec/defines/frontend_spec.rb
  9. +28 −0 spec/defines/listen_spec.rb
  10. +6 −5 spec/spec_helper_acceptance.rb
  11. +33 −15 templates/fragments/_bind.erb
44 changes: 28 additions & 16 deletions CHANGELOG → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
##2014-11-04 - Supported Release 1.1.0
###Summary

This release primarily adds greater flexibility in the listen directive.

####Features
- Added `bind` parameter to `haproxy::frontend`

####Deprecations
- `bind_options` in `haproxy::frontend` is being deprecated in favor of `bind`
- Remove references to deprecated concat::setup class and update concat dependency

##2014-07-21 - Supported Release 1.0.0
###Summary

This supported release is the first stable release of haproxy! The updates to
this release allow you to customize pretty much everything that HAProxy has to
offer (that we could find at least).
Expand All @@ -22,66 +35,65 @@ offer (that we could find at least).
- Increase unit test coverage
- Fix balancermember server lines with multiple ports

2014-05-28 - Version 0.5.0

Summary:
##2014-05-28 - Version 0.5.0
###Summary

The primary feature of this release is a reorganization of the
module to match best practices. There are several new parameters
and some bug fixes.

Features:
####Features
- Reorganized the module to follow install/config/service pattern
- Added bind_options parameter to haproxy::listen
- Updated tests

Fixes:
####Fixes
- Add license file
- Whitespace cleanup
- Use correct port in README
- Fix order of concat fragments

2013-10-08 - Version 0.4.1
##2013-10-08 - Version 0.4.1

Summary:
###Summary

Fix the dependency for concat.

Fixes:
####Fixes
- Changed the dependency to be the puppetlabs/concat version.

2013-10-03 - Version 0.4.0
##2013-10-03 - Version 0.4.0

Summary:
###Summary

The largest feature in this release is the new haproxy::frontend
and haproxy::backend defines. The other changes are mostly to
increase flexibility.

Features:
####Features
- Added parameters to haproxy:
- `package_name`: Allows alternate package name.
- Add haproxy::frontend and haproxy::backend defines.
- Add an ensure parameter to balancermember so they can be removed.
- Made chroot optional

Fixes:
####Fixes
- Remove deprecation warnings from templates.

2013-05-25 - Version 0.3.0
Features:
##2013-05-25 - Version 0.3.0
####Features
- Add travis testing
- Add `haproxy::balancermember` `define_cookies` parameter
- Add array support to `haproxy::listen` `ipaddress` parameter

Bugfixes:
####Bugfixes
- Documentation
- Listen -> Balancermember dependency
- Config line ordering
- Whitespace
- Add template lines for `haproxy::listen` `mode` parameter

2012-10-12 - Version 0.2.0
##2012-10-12 - Version 0.2.0
- Initial public release
- Backwards incompatible changes all around
- No longer needs ordering passed for more than one listener
Expand Down
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

##Overview

The haproxy module provides the ability to install, configure, and manage HAProxy.
The haproxy module provides the ability to install, configure, and manage HAProxy.

##Module Description

Expand Down Expand Up @@ -121,6 +121,28 @@ haproxy::listen { 'puppet00':
},
}
```
###Configuring multi-network daemon listener

One might have more advanced needs for the listen block, then use the `$bind` parameter:

```puppet
haproxy::listen { 'puppet00':
mode => 'tcp',
options => {
'option' => [
'tcplog',
'ssl-hello-chk',
],
'balance' => 'roundrobin',
},
bind => {
'10.0.0.1:443' => ['ssl', 'crt', 'puppetlabs.com'],
'168.12.12.12:80' => [],
'192.168.122.42:80' => []
},
}
```
Note: `$ports` or `$ipaddress` and `$bind` are mutually exclusive

###Configuring HAProxy load-balanced member nodes

Expand Down Expand Up @@ -285,7 +307,10 @@ This type sets up a frontend service configuration block in haproxy.cfg. The HAP
**Parameters**

#####`bind_options`
Lists an array of options to be specified after the bind declaration in the bind's configuration block.
Lists an array of options to be specified after the bind declaration in the bind's configuration block. **Deprecated**: This parameter is being deprecated in favor of $bind

#####`bind`
A hash of ipaddress:port, with the haproxy bind options the address will have in the listening service's configuration block.

#####`ipaddress`
Specifies the IP address the proxy binds to. No value, '\*', and '0.0.0.0' mean that the proxy listens to all valid addresses on the system.
Expand Down Expand Up @@ -333,7 +358,10 @@ Using storeconfigs, you can export the `haproxy::balancermember` resources on al
**Parameters:**

#####`bind_options`
Sets the options to be specified after the bind declaration in the listening service's configuration block. Displays as an array.
Sets the options to be specified after the bind declaration in the listening service's configuration block. Displays as an array. **Deprecated**: This parameter is being deprecated in favor of $bind

#####`bind`
A hash of ipaddress:port, with the haproxy bind options the address will have in the listening service's configuration block.

#####`collect_exported`
Enables exported resources from `haproxy::balancermember` to be collected, serving as a form of autodiscovery. Displays as a Boolean and defaults to 'true'.
Expand Down
33 changes: 26 additions & 7 deletions manifests/frontend.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,22 @@
# comma-separated string or an array of strings which may be ports or
# hyphenated port ranges.
#
# [*bind*]
# Set of ip addresses, port and bind options
# $bind = { '10.0.0.1:80' => ['ssl', 'crt', '/path/to/my/crt.pem'] }
#
# [*ipaddress*]
# The ip address the proxy binds to. Empty addresses, '*', and '0.0.0.0'
# mean that the proxy listens to all valid addresses on the system.
# The ip address the proxy binds to.
# Empty addresses, '*', and '0.0.0.0' mean that the proxy listens
# to all valid addresses on the system.
#
# [*mode*]
# The mode of operation for the frontend service. Valid values are undef,
# 'tcp', 'http', and 'health'.
#
# [*bind_options*]
# An array of options to be specified after the bind declaration in the
# bind's configuration block.
# (Deprecated) An array of options to be specified after the bind declaration
# in the listening serivce's configuration block.
#
# [*options*]
# A hash of options that are inserted into the frontend service
Expand Down Expand Up @@ -61,18 +66,32 @@
# Gary Larizza <gary@puppetlabs.com>
#
define haproxy::frontend (
$ports,
$ports = undef,
$ipaddress = [$::ipaddress],
$bind = undef,
$mode = undef,
$bind_options = undef,
$collect_exported = true,
$options = {
'option' => [
'tcplog',
],
}
},
# Deprecated
$bind_options = '',
) {

if $ports and $bind {
fail('The use of $ports and $bind is mutually exclusive, please choose either one')
}
if $ipaddress and $bind {
fail('The use of $ipaddress and $bind is mutually exclusive, please choose either one')
}
if $bind_options {
warning('The $bind_options parameter is deprecated; please use $bind instead')
}
if $bind {
validate_hash($bind)
}
# Template uses: $name, $ipaddress, $ports, $options
concat::fragment { "${name}_frontend_block":
order => "15-${name}-00",
Expand Down
1 change: 0 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
$manage_service = undef,
$enable = undef,
) inherits haproxy::params {
include concat::setup

if $service_ensure != true and $service_ensure != false {
if ! ($service_ensure in [ 'running','stopped']) {
Expand Down
40 changes: 30 additions & 10 deletions manifests/listen.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@
# hyphenated port ranges.
#
# [*ipaddress*]
# The ip address the proxy binds to. Empty addresses, '*', and '0.0.0.0'
# mean that the proxy listens to all valid addresses on the system.
# The ip address the proxy binds to.
# Empty addresses, '*', and '0.0.0.0' mean that the proxy listens
# to all valid addresses on the system.
#
# [*bind*]
# Set of ip addresses, port and bind options
# $bind = { '10.0.0.1:80' => ['ssl', 'crt', '/path/to/my/crt.pem'] }
#
# [*mode*]
# The mode of operation for the listening service. Valid values are undef,
Expand All @@ -39,8 +44,8 @@
# configuration block.
#
# [*bind_options*]
# An array of options to be specified after the bind declaration in the
# listening serivce's configuration block.
# (Deprecated) An array of options to be specified after the bind declaration
# in the listening serivce's configuration block.
#
# [*collect_exported*]
# Boolean, default 'true'. True means 'collect exported @@balancermember resources'
Expand Down Expand Up @@ -71,20 +76,35 @@
# Gary Larizza <gary@puppetlabs.com>
#
define haproxy::listen (
$ports,
$ipaddress = [$::ipaddress],
$mode = undef,
$collect_exported = true,
$options = {
$ports = undef,
$ipaddress = [$::ipaddress],
$bind = undef,
$mode = undef,
$collect_exported = true,
$options = {
'option' => [
'tcplog',
'ssl-hello-chk'
],
'balance' => 'roundrobin'
},
$bind_options = ''
# Deprecated
$bind_options = '',
) {

if $ports and $bind {
fail('The use of $ports and $bind is mutually exclusive, please choose either one')
}
if $ipaddress and $bind {
fail('The use of $ipaddress and $bind is mutually exclusive, please choose either one')
}
if $bind_options {
warning('The $bind_options parameter is deprecated; please use $bind instead')
}
if $bind {
validate_hash($bind)
}

if defined(Haproxy::Backend[$name]) {
fail("An haproxy::backend resource was discovered with the same name (${name}) which is not supported")
}
Expand Down
16 changes: 5 additions & 11 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "puppetlabs-haproxy",
"version": "1.0.0",
"version": "1.1.0",
"author": "Puppet Labs",
"summary": "Puppet module for HAProxy",
"license": "Apache-2.0",
"source": "https://github.com/puppetlabs/puppetlabs-haproxy",
"project_page": "https://github.com/puppetlabs/puppetlabs-haproxy",
"issues_url": "https://github.com/puppetlabs/puppetlabs-haproxy/issues",
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down Expand Up @@ -59,21 +59,15 @@
"requirements": [
{
"name": "pe",
"version_requirement": ">= 3.3.0 < 3.4.0"
"version_requirement": "3.x"
},
{
"name": "puppet",
"version_requirement": "3.x"
}
],
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 2.4.0"
},
{
"name": "puppetlabs/concat",
"version_requirement": ">= 1.0.0"
}
{"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0"},
{"name":"puppetlabs/concat","version_requirement":">= 1.1.0"}
]
}
2 changes: 0 additions & 2 deletions spec/classes/haproxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
'service_manage' => true
}
end
it { should contain_class('concat::setup') }
it 'should install the haproxy package' do
subject.should contain_package('haproxy').with(
'ensure' => 'present'
Expand Down Expand Up @@ -97,7 +96,6 @@
'service_manage' => false
}
end
it { should contain_class('concat::setup') }
it 'should install the haproxy package' do
subject.should contain_package('haproxy').with(
'ensure' => 'present'
Expand Down
13 changes: 13 additions & 0 deletions spec/defines/frontend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@
end
end
# C9949
context "when a ports parameter and a bind parameter are passed" do
let(:params) do
{
:name => 'apache',
:bind => {'192.168.0.1:80' => ['ssl']},
:ports => '80'
}
end

it 'should raise error' do
expect { subject }.to raise_error Puppet::Error, /mutually exclusive/
end
end
context "when multiple IPs are provided" do
let(:params) do
{
Expand Down
Loading