cookbook 'haproxy-ng', '= 0.2.12'
The haproxy-ng cookbook has been deprecated
Author provided reason for deprecation:
The haproxy-ng cookbook has been deprecated and is no longer being maintained by its authors. Use of the haproxy-ng cookbook is no longer recommended.
You may find that the haproxy cookbook is a suitable alternative.
haproxy-ng
(36) Versions
0.2.12
-
Follow11
modern, resource-driven cookbook for managing haproxy
cookbook 'haproxy-ng', '= 0.2.12', :supermarket
knife supermarket install haproxy-ng
knife supermarket download haproxy-ng
haproxy-ng cookbook
A resource-driven cookbook for configuring HAProxy.
Cookbook builds on 2 core resources:
-
haproxy_instance
: the "parent" resource, which maps to a complete configuration and (probably) a running haproxy daemon -
haproxy_proxy
: the "core" proxy resource, which maps to a specific proxy
Additional resources haproxy_peers
, haproxy_userlist
, haproxy_frontend
,
haproxy_backend
, haproxy_defaults
, and haproxy_listen
extend the haproxy_proxy
resource with additional validation for common configuration keywords for their respective
proxy types.
Suggested background reading:
- The Fine Manual
- This README, the modules in
libraries/00_helpers.rb
, and the individual resources/providers - the test target and example wrapper cookbook 'test/fixtures/cookbooks/my-lb'
Recipes
haproxy-ng::default
Configures a default instance, 'haproxy_instance[haproxy]', and corresponding
'haproxy' service via the config
, tuning
, and proxies
cookbook attributes
(which are mapped onto the corresponding resource attributes).
This recipe also provides a useful example of using the provided helper,
Haproxy::Helpers#proxy
, to map a list of proxies to their corresponding
resources in the resource collection. It also illustrates the recommended
pattern of proxying service reloads through a validating execute resource.
See wrapper cookbook example at 'test/fixtures/cookbooks/my-lb'.
haproxy-ng::install
Installs haproxy via the node['haproxy']['install_method']
method.
Supports 'package', 'source', and 'ppa'.
haproxy-ng::service
Configures a default-named ("haproxy") service resource.
Useful for typical installs running a single haproxy daemon under the default
'haproxy' service name. Service providers, or those running multiple haproxy
daemons on a single host will most likely want to configure a service instance
per haproxy_instance.
Attributes
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>install_method</td>
<td>
One of: 'package', 'source', 'ppa'
</td>
<td><code>package</code></td>
</tr>
<tr>
<td>proxies</td>
<td>
Array of proxy names for the default haproxy_instance[haproxy].
Useful when used in conjunction with a wrapper cookbook that
includes the default recipe.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>config</td>
<td>
Array of global configuration keywords passed to the config
attribute
of the haproxy_instance[haproxy] resource in the default recipe.
</td>
<td><code>See attributes/default.rb
</code></td>
</tr>
<tr>
<td>tuning</td>
<td>
Array of global configuration keywords passed to the tuning
attribute
of the haproxy_instance[haproxy] resource in the default recipe.
</td>
<td><code>See attributes/default.rb
</code></td>
</tr>
</tbody>
</table>
Resources
haproxy_instance
The "parent" resource. Maps 1-to-1 with a generated haproxy config file,
and most likely to a running service.
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>config</td>
<td>
Array of global keywords relevant to process management.
See libraries/00_helpers.rb
or haproxy manual for permissible keywords.
</td>
<td><code>['daemon']</code></td>
</tr>
<tr>
<td>tuning</td>
<td>
Array of global keywords relevant to performance tuning.
See libraries/00_helpers.rb
or haproxy manual for permissible keywords.
</td>
<td><code>['maxconn 256']</code></td>
</tr>
<tr>
<td>debug</td>
<td>
Global keyword string relevant to debugging (either 'debug', or 'quiet').
</td>
<td><code>app</code></td>
</tr>
<tr>
<td>proxies</td>
<td>
Array of Chef::Resource::HaproxyProxy instances
(haproxy_{peers,userlist,defaults,frontend,backend,listen}
included).
See the default
recipe for an example of using the provided
Haproxy::Helpers#proxy
method to generate this list from the
resource_collection.
</td>
<td><code>[]</code></td>
</tr>
</tbody>
</table>
haproxy_proxy
The simplest proxy representation and base class for the other
proxy resources (peers, userlist, defaults, frontend, backend, listen).
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>type</td>
<td>
String representing the proxy type. One of:
defaults, frontend, backend, listen, peers, userlist.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>config</td>
<td>
Array of proxy keywords, validated against specified proxy type.
See libraries/00_helpers.rb
or haproxy manual for permissible keywords.
</td>
<td><code>[]</code></td>
</tr>
</tbody>
</table>
haproxy_peers
Maps to a peers block in haproxy configuration. Not actually a proxy,
but treating it like one is useful for code reusability. Don't judge me.
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>peers</td>
<td>
Array of Hashes. Hashes require keys 'name', 'config'.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>config</td>
<td>
Array of peers keywords, validated against valid peers keywords.
See libraries/00_helpers.rb
or haproxy manual for permissible keywords.
</td>
<td><code>[]</code></td>
</tr>
</tbody>
</table>
haproxy_userlist
Maps to a userlist block in haproxy configuration. Also not actually a proxy,
as such.
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>groups</td>
<td>
Array of Hashes. Hashes require keys 'name', 'config.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>users</td>
<td>
Array of Hashes. Hashes require keys 'name', 'config'.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>config</td>
<td>
Array of userlist keywords, validated against valid userlist keywords.
See libraries/00_helpers.rb
or haproxy manual for permissible keywords.
</td>
<td><code>[]</code></td>
</tr>
</tbody>
</table>
haproxy_defaults
Maps to a 'defaults' block in haproxy configuration. Convention
suggests that resource names be capitalized (e.g. haproxy_defaults[HTTP]).
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>mode</td>
<td>
String specifying listener mode. One of: http, tcp, health.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>default_backend</td>
<td>
String specifying argument to default_backend
keyword.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>balance</td>
<td>
String specifying the desired load-balancing algorithm.
See BALANCE_ALGORITHMS
in libraries/00_helpers.rb or haproxy
manual for permissible balance
keyword arguments.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>source</td>
<td>
String
specifying arguments to the 'source' keyword.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>config</td>
<td>
Array of proxy keywords, validated against 'defaults' proxy type.
See libraries/00_helpers.rb
or haproxy manual for permissible keywords.
</td>
<td><code>[]</code></td>
</tr>
</tbody>
</table>
haproxy_frontend
Maps to a frontend block in the instance configuration,
and typically to one or more listening ports or sockets.
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>mode</td>
<td>
String specifying listener mode. One of: http, tcp, health.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>acls</td>
<td>
Array of hashes. Each hash must contain keys name
, and criterion
.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>description</td>
<td>
A String
describing the related proxy.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>bind</td>
<td>
String
or Array
of strings containing arguments to bind
keyword.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>default_backend</td>
<td>
String specifying argument to default_backend
keyword.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>use_backends</td>
<td>
Array of Hashes mapping to a list of use_backend
directives.
Each hash is verified to have keys backend
and condition
.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>config</td>
<td>
Array of proxy keywords, validated against 'frontend' proxy type.
See libraries/00_helpers.rb
or haproxy manual for permissible keywords.
</td>
<td><code>[]</code></td>
</tr>
</tbody>
</table>
haproxy_backend
Maps to a backend configuration block in haproxy configuration.
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>mode</td>
<td>
String specifying proxy mode. One of: http, tcp, health.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>acls</td>
<td>
Array of hashes. Each hash must contain keys name
, and criterion
.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>description</td>
<td>
A String
describing the related proxy.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>balance</td>
<td>
String specifying the desired load-balancing algorithm.
See BALANCE_ALGORITHMS
in libraries/00_helpers.rb or haproxy
manual for permissible balance
keyword arguments.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>source</td>
<td>
String
specifying arguments to the 'source' keyword.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>servers</td>
<td>
Array of Hashes
. Each Hash
must contain keys name
, address
, port
,
and optionally config
.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>config</td>
<td>
Array of proxy keywords, validated against 'backend' proxy type.
See libraries/00_helpers.rb
or haproxy manual for permissible keywords.
</td>
<td><code>[]</code></td>
</tr>
</tbody>
</table>
haproxy_listen
Maps to a listen configuration block, combines frontend and backend config
blocks into a single proxy. Less flexible, but more concise. Typically used
for tcp-mode proxies with a 1:1 frontend:backend mapping.
<table>
<thead>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Default Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>mode</td>
<td>
String specifying proxy mode. One of: http, tcp, health.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>acls</td>
<td>
Array of hashes. Each hash must contain keys name
, and criterion
.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>description</td>
<td>
A String
describing the related proxy.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>balance</td>
<td>
String specifying the desired load-balancing algorithm.
See BALANCE_ALGORITHMS
in libraries/00_helpers.rb or haproxy
manual for permissible balance
keyword arguments.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>source</td>
<td>
String
specifying arguments to the 'source' keyword.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>servers</td>
<td>
Array of Hashes
. Each Hash
must contain keys name
, address
, port
,
and optionally config
.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>bind</td>
<td>
String
or Array
of strings containing arguments to bind
keyword.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>default_backend</td>
<td>
String specifying argument to default_backend
keyword.
</td>
<td><code>nil</code></td>
</tr>
<tr>
<td>use_backends</td>
<td>
Array of Hash
es mapping to a list of use_backend
directives.
Each hash is verified to have keys backend
and condition
.
</td>
<td><code>[]</code></td>
</tr>
<tr>
<td>config</td>
<td>
Array of proxy keywords, validated against 'backend' proxy type.
See libraries/00_helpers.rb
or haproxy manual for permissible keywords.
</td>
<td><code>[]</code></td>
</tr>
</tbody>
</table>
0.2.12 / 2015-05-09
- add extra keyword
0.2.11 / 2015-05-07
- explicitly list supported service actions (thanks @alefend)
0.2.10 / 2015-05-06
- fix cops
- bump to latest stable haproxy for source build
0.2.9 / 2015-04-03
- misc. doc updates
- misc. testing improvements
- backport upstream improvements to systemd service file
- sort servers by name to reduce unnecessary restart/reload
0.2.8 / 2015-02-27
- doc updates
0.2.7 / 2015-02-27
- unit testing improvements
- fix bind keyword matrix entry
0.2.6 / 2015-02-25
- add ppa install method (thanks @elementai!)
0.2.5 / 2015-02-25
- fix service setup on fedora when doing source install
0.2.4 / 2015-02-23
- fix stick-table entry
0.2.3 / 2015-02-19
- add peers resource
- add userlist resource
0.2.2 / 2015-02-17
- enable source install
- docs and testing updates
0.2.1 / 2015-02-13
- permit abuse of proxy resource for configuration of peers, userlists
- various testing improvements
0.2.0 / 2015-02-11
- set type as required attribute for haproxy_proxy resource
- remove default proxy list, proxies recipe
- various and sundry documentation and testing improvements
- add negated keyword equivalents where appropriate
0.1.22 / 2015-02-10
- fix Haproxy::Proxy::NonDefaults.merged_config source merge
0.1.20 / 2015-02-10
- instance resource filters on actionable proxies
- remove peer/usergroups attrs from instance resource pending actual build-out
- extract default instance config into attributes to make it easier to consume default recipe
0.1.18 / 2015-02-09
- add timeout options to redis listen proxy
- move mode attr back into modules
0.1.16 / 2015-02-09
- fix balance keyword for DefaultsBackend
0.1.14 / 2015-02-09
- add listen resource to default recipe for testing
- move mode attribute under general proxy resource
0.1.12 / 2015-02-09
- fix listen provider
- add dummy listen resource to default recipe
0.1.10 / 2015-02-09
- use strings as keys
0.1.8 / 2015-02-09
- fix option typo
0.1.6 / 2015-02-09
- fix type for listen resource
0.1.4 / 2015-02-06
- use the correct resource provider for the listener resource
0.1.2 / 2015-02-05
- more build-out, consolidation of attributes common to multiple resources
0.1.0 / 2015-02-03
- initial release
Foodcritic Metric
0.2.12 passed this metric
0.2.12 passed this metric