Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FM-7934] - Puppet Strings #365

Merged
merged 3 commits into from
May 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
499 changes: 1 addition & 498 deletions README.md

Large diffs are not rendered by default.

1,739 changes: 1,739 additions & 0 deletions REFERENCE.md

Large diffs are not rendered by default.

54 changes: 26 additions & 28 deletions manifests/backend.pp
Original file line number Diff line number Diff line change
@@ -1,56 +1,54 @@
# == Define Resource Type: haproxy::backend
#
# This type will setup a backend service configuration block inside the
# haproxy.cfg file on an haproxy load balancer. Each backend service needs one
# or more backend member servers (that can be declared with the
# haproxy::balancermember defined resource type). Using storeconfigs, you can
# export the haproxy::balancermember resources on all load balancer member
# servers and then collect them on a single haproxy load balancer server.
#
# === Requirement/Dependencies:
#
# Currently requires the puppetlabs/concat module on the Puppet Forge and
# uses storeconfigs on the Puppet Master to export/collect resources
# from all backend members.
#
# === Parameters
#
# [*section_name*]
# @summary
# This type will setup a backend service configuration block inside the
# haproxy.cfg file on an haproxy load balancer.
# @note
# Each backend service needs one
# or more backend member servers (that can be declared with the
# haproxy::balancermember defined resource type). Using storeconfigs, you can
# export the haproxy::balancermember resources on all load balancer member
# servers and then collect them on a single haproxy load balancer server.
#
# @note
# Currently requires the puppetlabs/concat module on the Puppet Forge and
# uses storeconfigs on the Puppet Master to export/collect resources
# from all backend members.
#
# @param section_name
# This name goes right after the 'backend' statement in haproxy.cfg
# Default: $name (the namevar of the resource).
#
# [*mode*]
# @param mode
# The mode of operation for the backend service. Valid values are undef,
# 'tcp', 'http', and 'health'.
#
# [*options*]
# @param options
# A hash of options that are inserted into the backend configuration block.
#
# [*collect_exported*]
# @param collect_exported
# Boolean, default 'true'. True means 'collect exported @@balancermember
# resources' (for the case when every balancermember node exports itself),
# false means 'rely on the existing declared balancermember resources' (for
# the case when you know the full set of balancermember in advance and use
# haproxy::balancermember with array arguments, which allows you to deploy
# everything in 1 run)
#
# [*config_file*]
# @param config_file
# Optional. Path of the config file where this entry will be added.
# Assumes that the parent directory exists.
# Default: $haproxy::params::config_file
#
# [*sort_options_alphabetic*]
# @param sort_options_alphabetic
# Sort options either alphabetic or custom like haproxy internal sorts them.
# Defaults to true.
#
# [*defaults*]
# @param defaults
# Name of the defaults section this backend will use.
# Defaults to undef which means the global defaults section will be used.
#
# @param instance
# Optional. Defaults to 'haproxy'
#
# === Examples
#
# Exporting the resource for a backend member:
#
# @example
# haproxy::backend { 'puppet00':
# options => {
# 'option' => [
Expand Down
52 changes: 29 additions & 23 deletions manifests/balancermember.pp
Original file line number Diff line number Diff line change
@@ -1,87 +1,91 @@
# == Define Resource Type: haproxy::balancermember
#
# This type will setup a balancer member inside a listening service
# @summary
# This type will setup a balancer member inside a listening service
# configuration block in /etc/haproxy/haproxy.cfg on the load balancer.
# currently it only has the ability to specify the instance name,
#
# @note
# Currently it only has the ability to specify the instance name,
# ip address, port, and whether or not it is a backup. More features
# can be added as needed. The best way to implement this is to export
# this resource for all haproxy balancer member servers, and then collect
# them on the main haproxy load balancer.
#
# === Requirement/Dependencies:
#
# Currently requires the puppetlabs/concat module on the Puppet Forge and
# @note
# Currently requires the puppetlabs/concat module on the Puppet Forge and
# uses storeconfigs on the Puppet Master to export/collect resources
# from all balancer members.
#
# === Parameters
#
# [*listening_service*]
# @param listening_service
# 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*]
# @param 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.
#
# [*port*]
# @param port
# A port for server-template. It is an optional specification.
#
# [*server_names*]
# @param 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. 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).
#
# [*ipaddresses*]
# @param ipaddresses
# The ip address used to contact the balancer member server.
# Can be an array, see documentation to server_names.
#
# [*prefix*]
# @param prefix
# A prefix for the server-template for the server names to be built.
#
# [*amount*]
# @param amount
# If "amount" is provided, the server-template initializes <num> servers
# with 1 up to <num> as server name suffixes. A range of numbers
# <num_low>-<num_high> may also be used to use <num_low> up to
# <num_high> as server name suffixes.
#
# [*fqdn*]
# @param fqdn
# A FQDN for all the servers the server-template initializes.
#
# [*options*]
# @param options
# An array of options to be specified after the server declaration
# in the listening service's configuration block.
#
# [*define_cookies*]
# @param define_cookies
# If true, then add "cookie SERVERID" stickiness options.
# Default false.
#
# [*defaults*]
# @param defaults
# Name of the defaults section the backend or listener use.
# Defaults to undef.
#
# [*config_file*]
# @param config_file
# Optional. Path of the config file where this entry will be added.
# Assumes that the parent directory exists.
# Default: $haproxy::params::config_file
#
# [*verifyhost*]
# @param verifyhost
# Optional. Will add the verifyhost option to the server line, using the
# specific host from server_names as an argument.
# Default: false
#
# [*weight*]
# @param weight
# Optional. Will add the weight option to the server line
# Default: undef
#
# === Examples
# @param instance
# Optional. Defaults to 'haproxy'
#
# @param type
# Optional. Defaults to 'server'
#
# @example
# Exporting the resource for a balancer member:
#
# @@haproxy::balancermember { 'haproxy':
Expand All @@ -97,6 +101,7 @@
#
# Haproxy::Balancermember <<| listening_service == 'puppet00' |>>
#
# @example
# 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):
Expand All @@ -109,6 +114,7 @@
# options => 'check',
# }
#
# @example
# Implemented in HAPROXY 1.8:
# Set a template to initialize servers with shared parameters.
# The names of these servers are built from <prefix> and <amount> parameters.
Expand Down
2 changes: 1 addition & 1 deletion manifests/balancermember/collect_exported.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Private define
# @api private
define haproxy::balancermember::collect_exported {
if $caller_module_name != $module_name {
fail("Use of private class ${name} by ${caller_module_name}")
Expand Down
5 changes: 3 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Private class
#
# @summary
# HAProxy configuration
# @api private
define haproxy::config (
# lint:ignore:140chars
$instance_name,
Expand Down
21 changes: 12 additions & 9 deletions manifests/defaults.pp
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# == Define Resource Type: haproxy::defaults
# @summary
# This type will setup a additional defaults configuration block inside the
# haproxy.cfg file on an haproxy load balancer.
#
# This type will setup a additional defaults configuration block inside the
# haproxy.cfg file on an haproxy load balancer. A new default configuration
# block resets all defaults of prior defaults configuration blocks. Listener,
# Backends, Frontends and Balancermember can be configured behind a default
# @note
# A new default configuration block resets all defaults of prior defaults configuration blocks.
# Listener, Backends, Frontends and Balancermember can be configured behind a default
# configuration block by setting the defaults parameter to the corresponding
# defaults name.
#
# === Parameters:
#
# [*options*]
# @param options
# A hash of options that are inserted into the defaults configuration block.
#
# [*sort_options_alphabetic*]
# @param sort_options_alphabetic
# Sort options either alphabetic or custom like haproxy internal sorts them.
# Defaults to true.

#
# @param instance
# Optional. Defaults to 'haproxy'.
#
define haproxy::defaults (
$options = {},
$sort_options_alphabetic = undef,
Expand Down
47 changes: 24 additions & 23 deletions manifests/frontend.pp
Original file line number Diff line number Diff line change
@@ -1,68 +1,69 @@
# == Define Resource Type: haproxy::frontend
# @summary
# This type will setup a frontend service configuration block inside
# the haproxy.cfg file on an haproxy load balancer.
#
# This type will setup a frontend service configuration block inside
# the haproxy.cfg file on an haproxy load balancer.
# @note
# Currently requires the puppetlabs/concat module on the Puppet Forge and
# uses storeconfigs on the Puppet Master to export/collect resources
# from all balancer members.
#
# === Requirement/Dependencies:
#
# Currently requires the puppetlabs/concat module on the Puppet Forge and
# uses storeconfigs on the Puppet Master to export/collect resources
# from all balancer members.
#
# === Parameters
#
# [*section_name*]
# @param section_name
# This name goes right after the 'frontend' statement in haproxy.cfg
# Default: $name (the namevar of the resource).
#
# [*ports*]
# @param ports
# Ports on which the proxy will listen for connections on the ip address
# specified in the ipaddress parameter. Accepts either a single
# comma-separated string or an array of strings which may be ports or
# hyphenated port ranges.
#
# [*bind*]
# @param bind
# Set of ip addresses, port and bind options
# $bind = { '10.0.0.1:80' => ['ssl', 'crt', '/path/to/my/crt.pem'] }
#
# [*ipaddress*]
# @param 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.
#
# [*mode*]
# @param mode
# The mode of operation for the frontend service. Valid values are undef,
# 'tcp', 'http', and 'health'.
#
# [*bind_options*]
# @param bind_options
# (Deprecated) An array of options to be specified after the bind declaration
# in the listening serivce's configuration block.
#
# [*options*]
# @param options
# A hash of options that are inserted into the frontend service
# configuration block.
#
# [*sort_options_alphabetic*]
# @param sort_options_alphabetic
# Sort options either alphabetic or custom like haproxy internal sorts them.
# Defaults to true.
#
# [*defaults*]
# @param defaults
# Name of the defaults section this backend will use.
# Defaults to undef which means the global defaults section will be used.
#
# [*defaults_use_backend*]
# @param defaults_use_backend
# If defaults are used and a default backend is configured use the backend
# name for ordering. This means that the frontend is placed in the
# configuration file before the backend configuration.
# Defaults to true.
#
# [*config_file*]
# @param config_file
# Optional. Path of the config file where this entry will be added.
# Assumes that the parent directory exists.
# Default: $haproxy::params::config_file
#
# === Examples
# @param collect_exported
# Boolean. Default true
#
# @param instance
# Optional. Defaults to 'haproxy'
#
# @example
# Exporting the resource for a balancer member:
#
# haproxy::frontend { 'puppet00':
Expand Down
9 changes: 3 additions & 6 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# == Class: haproxy::globals
# @summary
# For global configuration options used by all haproxy instances.
#
# For global configuration options used by all haproxy instances.
#
# === Parameters
#
# [*sort_options_alphabetic*]
# @param sort_options_alphabetic
# Sort options either alphabetic or custom like haproxy internal sorts them.
# Defaults to true.
#
Expand Down
Loading