5 changes: 5 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fixtures:
repositories:
concat: "git://github.com/ripienaar/puppet-concat.git"
symlinks:
haproxy: "#{source_dir}"
5 changes: 5 additions & 0 deletions .gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source :rubygems

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: ruby
rvm:
- 1.8.7
- 1.9.3
script: "rake spec"
branches:
only:
- master
env:
- PUPPET_VERSION=2.6.17
- PUPPET_VERSION=2.7.19
#- PUPPET_VERSION=3.0.1 # Breaks due to rodjek/rspec-puppet#58
notifications:
email: false
gemfile: .gemfile
matrix:
exclude:
- rvm: 1.9.3
gemfile: .gemfile
env: PUPPET_VERSION=2.6.17
- rvm: 1.8.7
gemfile: .gemfile
env: PUPPET_VERSION=3.0.1
18 changes: 18 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
2013-05-25 - Version 0.3.0
Features:
- Add travis testing
- Add `haproxy::basancermember` `define_cookies` parameter
- Add array support to `haproxy::listen` `ipaddress` parameter

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

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
- Accepts multiple listen ips/ports/server_names
8 changes: 4 additions & 4 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name 'puppet-haproxy'
version '0.0.1'
source 'git://github.com/glarizza/puppet-haproxy'
name 'puppetlabs-haproxy'
version '0.3.0'
source 'git://github.com/puppetlabs/puppetlabs-haproxy'
author 'Puppet Labs'
license 'Apache License, Version 2.0'
summary 'Haproxy Module'
description 'An Haproxy module for Redhat family OSes using Storeconfigs'
project_page 'http://github.com/glarizza/puppet-haproxy'
project_page 'http://github.com/puppetlabs/puppetlabs-haproxy'

## Add dependencies, if any:
# dependency 'username/name', '>= 1.2.0'
Expand Down
14 changes: 0 additions & 14 deletions README

This file was deleted.

83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
PuppetLabs Module for haproxy
=============================

HAProxy is an HA proxying daemon for load-balancing to clustered services. It
can proxy TCP directly, or other kinds of traffic such as HTTP.

Basic Usage
-----------

This haproxy uses storeconfigs to collect and realize balancer member servers
on a load balancer server. Currently Redhat family OSes are supported.

*To install and configure HAProxy server listening on port 80*

```puppet
node 'haproxy-server' {
class { 'haproxy': }
haproxy::listen { 'puppet00':
ipaddress => $::ipaddress,
ports => '8140',
}
}
```

*To add backend loadbalance members*

```puppet
node 'webserver01' {
@@haproxy::balancermember { $fqdn:
listening_service => 'puppet00',
server_names => $::hostname,
ipaddresses => $::ipaddress,
ports => '8140',
options => 'check'
}
}
```

Configuring haproxy options
---------------------------

The base `haproxy` class can accept two parameters which will configure basic
behaviour of the haproxy server daemon:

- `global_options` to configure the `global` section in `haproxy.cfg`
- `defaults_options` to configure the `defaults` section in `haproxy.cfg`

Configuring haproxy daemon listener
-----------------------------------

One `haproxy::listen` defined resource should be defined for each HAProxy loadbalanced set of backend servers. The title of the `haproxy::listen` resource is the key to which balancer members will be proxied to. The `ipaddress` field should be the public ip address which the loadbalancer will be contacted on. The `ports` attribute can accept an array or comma-separated list of ports which should be proxied to the `haproxy::balancermember` nodes.

Configuring haproxy loadbalanced member nodes
---------------------------------------------

The `haproxy::balancermember` defined resource should be exported from each node
which is serving loadbalanced traffic. the `listening_service` attribute will
associate it with `haproxy::listen` directives on the haproxy node.
`ipaddresses` and `ports` will be assigned to the member to be contacted on. If an array of `ipaddresses` and `server_names` are provided then they will be added to the config in lock-step.

Dependencies
------------

Tested and built on Ubuntu and CentOS

Copyright and License
---------------------

Copyright (C) 2012 [Puppet Labs](https://www.puppetlabs.com/) Inc

Puppet Labs can be contacted at: info@puppetlabs.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'puppetlabs_spec_helper/rake_tasks'
81 changes: 47 additions & 34 deletions manifests/balancermember.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,65 +21,78 @@
# fragment name.
#
# [*listening_service*]
# The haproxy service's instance name (or, the title of the
# haproxy::config resource). This must match up with a declared
# haproxy::config resource.
#
# [*balancer_port*]
# A unique port for which the balancer member will accept connections
# from the load balancer. Note that cookie values aren't yet supported,
# but shouldn't be difficult to add to the configuration.
#
# [*order*]
# The order, or numerical weight, of the fragment created by this defined
# resource type. This is necessary to ensure the fragment is associated
# with the correct listening service instance.
#
# [*server_name*]
# The haproxy service's instance name (or, the title of the
# haproxy::listen resource). This must match up with a declared
# haproxy::listen resource.
#
# [*ports*]
# An array or commas-separated list of ports for which the balancer member
# will accept connections from the load balancer. Note that cookie values
# aren't yet supported, but shouldn't be difficult to add to the
# configuration. If you use an array in server_names and ipaddresses, the
# same port is used for all balancermembers.
#
# [*server_names*]
# The name of the balancer member server as known to haproxy in the
# listening service's configuration block. This defaults to the
# hostname
# hostname. Can be an array of the same length as ipaddresses,
# in which case a balancermember is created for each pair of
# server_names and ipaddresses (in lockstep).
#
# [*balancer_ip*]
# The ip address used to contact the balancer member server
# [*ipaddresses*]
# The ip address used to contact the balancer member server.
# Can be an array, see documentation to server_names.
#
# [*balancermember_options*]
# [*options*]
# An array of options to be specified after the server declaration
# in the listening service's configuration block.
#
# [*define_cookies*]
# If true, then add "cookie SERVERID" stickiness options.
# Default false.
#
# === Examples
#
# Exporting the resource for a balancer member:
#
# @@haproxy::balancermember { 'haproxy':
# listening_service => 'puppet00',
# balancer_port => '8140',
# order => '21',
# server_name => $::hostname,
# balancer_ip => $::ipaddress,
# balancermember_options => 'check',
# listening_service => 'puppet00',
# ports => '8140',
# server_names => $::hostname,
# ipaddresses => $::ipaddress,
# options => 'check',
# }
#
#
# Collecting the resource on a load balancer
#
# Haproxy::Balancermember <<| listening_service == 'puppet00' |>>
#
# === Authors
#
# Gary Larizza <gary@puppetlabs.com>
# Creating the resource for multiple balancer members at once
# (for single-pass installation of haproxy without requiring a first
# pass to export the resources if you know the members in advance):
#
# haproxy::balancermember { 'haproxy':
# listening_service => 'puppet00',
# ports => '8140',
# server_names => ['server01', 'server02'],
# ipaddresses => ['192.168.56.200', '192.168.56.201'],
# options => 'check',
# }
#
# (this resource can be declared anywhere)
#
define haproxy::balancermember (
$listening_service,
$balancer_port,
$order = '20',
$server_name = $::hostname,
$balancer_ip = $::ipaddress,
$balancermember_options = ''
$ports,
$server_names = $::hostname,
$ipaddresses = $::ipaddress,
$options = '',
$define_cookies = false
) {
# Template uses $ipaddresses, $server_name, $ports, $option
concat::fragment { "${listening_service}_balancermember_${name}":
order => $order,
order => "20-${listening_service}-${name}",
target => '/etc/haproxy/haproxy.cfg',
content => template('haproxy/haproxy_balancermember.erb'),
}
Expand Down
75 changes: 0 additions & 75 deletions manifests/config.pp

This file was deleted.

29 changes: 0 additions & 29 deletions manifests/data.pp

This file was deleted.

Loading