diff options
author | Dan Bode <bodepd@gmail.com> | 2012-10-10 11:24:45 -0700 |
---|---|---|
committer | Dan Bode <bodepd@gmail.com> | 2012-10-10 11:24:45 -0700 |
commit | 82cc860495ebb89a08dd02191ec34f5d8b858592 (patch) | |
tree | f735853784862f673994bf8ff3fd2bdd812fa433 /manifests | |
parent | 42fa1a9c2ecd8c0aebfd37bcb3fc22a36d6d5947 (diff) | |
parent | de44dd1098d99f2f070d0db13ff5e0542be146e1 (diff) |
Merge pull request #4 from Mirantis/one-pass
Support for one-pass mode.
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/balancermember.pp | 24 | ||||
-rw-r--r-- | manifests/config.pp | 16 |
2 files changed, 36 insertions, 4 deletions
diff --git a/manifests/balancermember.pp b/manifests/balancermember.pp index 29fb382..af5728e 100644 --- a/manifests/balancermember.pp +++ b/manifests/balancermember.pp @@ -29,6 +29,8 @@ # 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. +# If you use an array in server_name and balancer_ip, the same port is +# used for all balancermembers. # # [*order*] # The order, or numerical weight, of the fragment created by this defined @@ -38,10 +40,13 @@ # [*server_name*] # 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 balancer_ip, +# in which case a balancermember is created for each pair of +# server_name and balancer_ip (in lockstep). # # [*balancer_ip*] -# The ip address used to contact the balancer member server +# The ip address used to contact the balancer member server. +# Can be an array, see documentation to server_name. # # [*balancermember_options*] # An array of options to be specified after the server declaration @@ -66,6 +71,21 @@ # # Haproxy::Balancermember <<| listening_service == 'puppet00' |>> # +# 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', +# balancer_port => '8140', +# order => '21', +# server_name => ['server01', 'server02'], +# balancer_ip => ['192.168.56.200', '192.168.56.201'], +# balancermember_options => 'check', +# } +# +# (this resource can be declared anywhere) +# # === Authors # # Gary Larizza <gary@puppetlabs.com> diff --git a/manifests/config.pp b/manifests/config.pp index 5825dd0..444905b 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -40,7 +40,14 @@ # [*haproxy_config_options*] # A hash of options that are inserted into the listening service # configuration block. -# +# +# [*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 balancermembers in advance and use haproxy::balancermember +# with array arguments, which allows you to deploy everything in 1 run) +# # # === Examples # @@ -67,6 +74,7 @@ define haproxy::config ( $haproxy_config_options = {'option' => ['tcplog', 'ssl-hello-chk'], 'balance' => 'roundrobin'}, + $collect_exported = true, ) { concat::fragment { "${name}_config_block": order => $order, @@ -74,5 +82,9 @@ define haproxy::config ( content => template('haproxy/haproxy_config_block.erb'), } - Haproxy::Balancermember <<| listening_service == $name |>> + if $collect_exported { + Haproxy::Balancermember <<| listening_service == $name |>> + } + # else: the resources have been created and they introduced their + # concat fragments. We don't have to do anything about them. } |