From 8a56bba7a7ac6376627e64be00d3ca2db14fdf71 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Tue, 12 Jun 2012 19:16:02 -0700 Subject: Add Debian support. This pull requests performs the minimum amount of effort to add Debian support. Adds Debian defaults (which were made to be as similar as possible to the Redhat defaults) Adds two Debian specific resources to the haproxy class - a defaults file to ensure the service is started - creates the /var/lib/haproxy directory so that the configuration can be as similar to Redhat as possible.y --- manifests/data.pp | 18 ++++++++++++++++++ manifests/init.pp | 13 +++++++++++++ 2 files changed, 31 insertions(+) (limited to 'manifests') diff --git a/manifests/data.pp b/manifests/data.pp index aa49285..db865d6 100644 --- a/manifests/data.pp +++ b/manifests/data.pp @@ -24,6 +24,24 @@ class haproxy::data { 'maxconn' => '8000' } } + Debian: { + $haproxy_global_options = { 'log' => "127.0.0.1 local0", + 'chroot' => '/var/lib/haproxy', + 'pidfile' => '/var/run/haproxy.pid', + 'maxconn' => '4000', + 'user' => 'haproxy', + 'group' => 'haproxy', + 'daemon' => '', + 'stats' => 'socket /var/lib/haproxy/stats' + } + $haproxy_defaults_options = { 'log' => 'global', + 'stats' => 'enable', + 'option' => 'redispatch', + 'retries' => '3', + 'timeout' => ['http-request 10s', 'queue 1m', 'connect 10s', 'client 1m', 'server 1m', 'check 10s'], + 'maxconn' => '8000' + } + } default: { fail("The $::operatingsystem operating system is not supported with the haproxy module") } } } diff --git a/manifests/init.pp b/manifests/init.pp index 8005aec..8fc46ac 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -97,6 +97,19 @@ class haproxy ( order => '10', content => template('haproxy/haproxy-base.cfg.erb'), } + + if ($::operatingsystem == 'Ubuntu') { + file { '/etc/default/haproxy': + content => 'ENABLED=1', + require => Package['haproxy'] + } + } + + file { '/var/lib/haproxy': + ensure => directory, + before => Service['haproxy'], + } + } service { 'haproxy': -- cgit v1.2.3 From 449bbee4b9f9bc31d8676fbdf5ad699f5b1987f0 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 29 Aug 2012 13:53:49 -0700 Subject: Log to $ipaddress by default on both platforms --- manifests/data.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/data.pp b/manifests/data.pp index db865d6..6b27068 100644 --- a/manifests/data.pp +++ b/manifests/data.pp @@ -25,7 +25,7 @@ class haproxy::data { } } Debian: { - $haproxy_global_options = { 'log' => "127.0.0.1 local0", + $haproxy_global_options = { 'log' => "${::ipaddress} local0", 'chroot' => '/var/lib/haproxy', 'pidfile' => '/var/run/haproxy.pid', 'maxconn' => '4000', -- cgit v1.2.3 From dc03ae98bcb95559f7faf4bea72fa810dcdc4c8f Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 29 Aug 2012 13:54:33 -0700 Subject: /etc/default/haproxy applies to all Debian, not just Ubuntu --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 8fc46ac..93c7e17 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -98,7 +98,7 @@ class haproxy ( content => template('haproxy/haproxy-base.cfg.erb'), } - if ($::operatingsystem == 'Ubuntu') { + if ($::osfamily == 'Debian') { file { '/etc/default/haproxy': content => 'ENABLED=1', require => Package['haproxy'] -- cgit v1.2.3 From 6bb22697689bb7a8ed76afe69a4a245760d12708 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 29 Aug 2012 13:55:08 -0700 Subject: The directory resource for managing the chroot should be a variable --- manifests/init.pp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 93c7e17..2feacf2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -105,7 +105,7 @@ class haproxy ( } } - file { '/var/lib/haproxy': + file { $haproxy_global_options['chroot']: ensure => directory, before => Service['haproxy'], } @@ -124,6 +124,9 @@ class haproxy ( name => 'haproxy', hasrestart => true, hasstatus => true, - require => Concat['/etc/haproxy/haproxy.cfg'], + require => [ + Concat['/etc/haproxy/haproxy.cfg'], + File[$haproxy_global_options['chroot']], + ], } } -- cgit v1.2.3 From 12a8a5d6e0419f26265e325a8cf1e4019dc23895 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Wed, 29 Aug 2012 13:55:40 -0700 Subject: Add a dependency to ENABLE=1 before starting the service on debian --- manifests/init.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 2feacf2..f75051c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -101,7 +101,8 @@ class haproxy ( if ($::osfamily == 'Debian') { file { '/etc/default/haproxy': content => 'ENABLED=1', - require => Package['haproxy'] + require => Package['haproxy'], + before => Service['haproxy'], } } -- cgit v1.2.3