diff options
author | Hunter Haugen <h.haugen@gmail.com> | 2012-10-12 11:28:24 -0700 |
---|---|---|
committer | Hunter Haugen <h.haugen@gmail.com> | 2012-10-12 11:32:01 -0700 |
commit | 3ab65f56a61cfedbe75a3b41143f0d44fbad0a93 (patch) | |
tree | 1318b8a2daf4ab737d4e01b85328315a2df926ac /manifests | |
parent | f96656440027fbfc73bccf1911c817d7e4392713 (diff) |
Rename everything!
What is renamed:
- Class/define:
- haproxy::config to haproxy::listen
- haproxy::data to haproxy::params
- Parameters:
- haproxy::listen listen_ip to ipaddress
- haproxy::listen config_options to options
- haproxy haproxy_global_options to global_options
- haproxy haproxy_defaults_options to defaults_options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/balancermember.pp | 4 | ||||
-rw-r--r-- | manifests/init.pp | 32 | ||||
-rw-r--r-- | manifests/listen.pp (renamed from manifests/config.pp) | 29 | ||||
-rw-r--r-- | manifests/params.pp (renamed from manifests/data.pp) | 12 |
4 files changed, 37 insertions, 40 deletions
diff --git a/manifests/balancermember.pp b/manifests/balancermember.pp index af5728e..d43d98a 100644 --- a/manifests/balancermember.pp +++ b/manifests/balancermember.pp @@ -22,8 +22,8 @@ # # [*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. +# haproxy::listen resource). This must match up with a declared +# haproxy::listen resource. # # [*balancer_port*] # A unique port for which the balancer member will accept connections diff --git a/manifests/init.pp b/manifests/init.pp index 7bf6aa9..92df8b8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,4 @@ -# == Class: puppet-haproxy +# == Class: haproxy # # A Puppet module, using storeconfigs, to model an haproxy configuration. # Currently VERY limited - assumes Redhat/CentOS setup. Pull requests accepted! @@ -15,13 +15,13 @@ # Chooses whether haproxy should be installed or ensured absent. # Currently ONLY accepts valid boolean true/false values. # -# [*haproxy_global_options*] +# [*global_options*] # A hash of all the haproxy global options. If you want to specify more # than one option (i.e. multiple timeout or stats options), pass those # options as an array and you will get a line for each of them in the # resultant haproxy.cfg file. # -# [*haproxy_defaults_options*] +# [*defaults_options*] # A hash of all the haproxy defaults options. If you want to specify more # than one option (i.e. multiple timeout or stats options), pass those # options as an array and you will get a line for each of them in the @@ -31,8 +31,8 @@ # === Examples # # class { 'haproxy': -# enable => true, -# haproxy_global_options => { +# enable => true, +# global_options => { # 'log' => "${::ipaddress} local0", # 'chroot' => '/var/lib/haproxy', # 'pidfile' => '/var/run/haproxy.pid', @@ -42,7 +42,7 @@ # 'daemon' => '', # 'stats' => 'socket /var/lib/haproxy/stats' # }, -# haproxy_defaults_options => { +# defaults_options => { # 'log' => 'global', # 'stats' => 'enable', # 'option' => 'redispatch', @@ -59,16 +59,12 @@ # }, # } # -# === Authors -# -# Gary Larizza <gary@puppetlabs.com> -# class haproxy ( - $manage_service = true, - $enable = true, - $haproxy_global_options = $haproxy::data::haproxy_global_options, - $haproxy_defaults_options = $haproxy::data::haproxy_defaults_options -) inherits haproxy::data { + $manage_service = true, + $enable = true, + $global_options = $haproxy::params::global_options, + $defaults_options = $haproxy::params::defaults_options +) inherits haproxy::params { include concat::setup package { 'haproxy': @@ -95,7 +91,7 @@ class haproxy ( content => "# This file managed by Puppet\n", } - # Most of the variables are used inside the haproxy-base.cfg.erb template + # Template uses $global_options, $defaults_options concat::fragment { 'haproxy-base': target => '/etc/haproxy/haproxy.cfg', order => '10', @@ -110,7 +106,7 @@ class haproxy ( } } - file { $haproxy_global_options['chroot']: + file { $global_options['chroot']: ensure => directory, before => Service['haproxy'], } @@ -132,7 +128,7 @@ class haproxy ( hasstatus => true, require => [ Concat['/etc/haproxy/haproxy.cfg'], - File[$haproxy_global_options['chroot']], + File[$global_options['chroot']], ], } } diff --git a/manifests/config.pp b/manifests/listen.pp index b9caf15..d4ddd60 100644 --- a/manifests/config.pp +++ b/manifests/listen.pp @@ -1,4 +1,4 @@ -# == Define Resource Type: haproxy::config +# == Define Resource Type: haproxy::listen # # This type will setup a listening service configuration block inside # the haproxy.cfg file on an haproxy load balancer. Each listening service @@ -30,7 +30,7 @@ # resource type. This is necessary to ensure the fragment is associated # with the correct listening service instance. # -# [*listen_ip*] +# [*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. # @@ -38,7 +38,7 @@ # The mode of operation for the listening service. Valid values are 'tcp', # HTTP', and 'health'. # -# [*config_options*] +# [*options*] # A hash of options that are inserted into the listening service # configuration block. # @@ -54,12 +54,12 @@ # # Exporting the resource for a balancer member: # -# haproxy::config { 'puppet00': -# order => '20', -# listen_ip => $::ipaddress, -# ports => '18140', -# mode => 'tcp', -# config_options => { +# haproxy::listen { 'puppet00': +# order => '20', +# ipaddress => $::ipaddress, +# ports => '18140', +# mode => 'tcp', +# options => { # 'option' => [ # 'tcplog', # 'ssl-hello-chk' @@ -72,13 +72,13 @@ # # Gary Larizza <gary@puppetlabs.com> # -define haproxy::config ( +define haproxy::listen ( $ports, $order = '20', - $listen_ip = $::ipaddress, + $ipaddress = $::ipaddress, $mode = 'tcp', $collect_exported = true, - $config_options = { + $options = { 'option' => [ 'tcplog', 'ssl-hello-chk' @@ -86,10 +86,11 @@ define haproxy::config ( 'balance' => 'roundrobin' } ) { - concat::fragment { "${name}_config_block": + # Template uses: $name, $ipaddress, $ports, $options + concat::fragment { "${name}_listen_block": order => $order, target => '/etc/haproxy/haproxy.cfg', - content => template('haproxy/haproxy_config_block.erb'), + content => template('haproxy/haproxy_listen_block.erb'), } if $collect_exported { diff --git a/manifests/data.pp b/manifests/params.pp index ab920ed..53442dd 100644 --- a/manifests/data.pp +++ b/manifests/params.pp @@ -1,13 +1,13 @@ -# == Class: haproxy::data +# == Class: haproxy::params # # This is a container class holding default parameters for for haproxy class. # currently, only the Redhat family is supported, but this can be easily # extended by changing package names and configuration file paths. # -class haproxy::data { +class haproxy::params { case $osfamily { Redhat: { - $haproxy_global_options = { + $global_options = { 'log' => "${::ipaddress} local0", 'chroot' => '/var/lib/haproxy', 'pidfile' => '/var/run/haproxy.pid', @@ -17,7 +17,7 @@ class haproxy::data { 'daemon' => '', 'stats' => 'socket /var/lib/haproxy/stats' } - $haproxy_defaults_options = { + $defaults_options = { 'log' => 'global', 'stats' => 'enable', 'option' => 'redispatch', @@ -34,7 +34,7 @@ class haproxy::data { } } Debian: { - $haproxy_global_options = { + $global_options = { 'log' => "${::ipaddress} local0", 'chroot' => '/var/lib/haproxy', 'pidfile' => '/var/run/haproxy.pid', @@ -44,7 +44,7 @@ class haproxy::data { 'daemon' => '', 'stats' => 'socket /var/lib/haproxy/stats' } - $haproxy_defaults_options = { + $defaults_options = { 'log' => 'global', 'stats' => 'enable', 'option' => 'redispatch', |