bfire 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/LICENSE +0 -0
  2. data/README.md +90 -0
  3. data/bin/bfire +120 -0
  4. data/examples/benchmark.rb +18 -0
  5. data/examples/dag.rb +26 -0
  6. data/examples/elasticity.rb +105 -0
  7. data/examples/ibbt.rb +125 -0
  8. data/examples/mine.rb +40 -0
  9. data/examples/modules/apache2/manifests/init.pp +44 -0
  10. data/examples/modules/app/files/app/app.rb +29 -0
  11. data/examples/modules/app/files/app/config.ru +2 -0
  12. data/examples/modules/app/files/app.phtml +4 -0
  13. data/examples/modules/app/manifests/init.pp +19 -0
  14. data/examples/modules/common/manifests/init.pp +8 -0
  15. data/examples/modules/haproxy/files/default +4 -0
  16. data/examples/modules/haproxy/files/haproxy.rsyslog.conf +2 -0
  17. data/examples/modules/haproxy/manifests/init.pp +21 -0
  18. data/examples/modules/mysql/manifests/init.pp +40 -0
  19. data/examples/modules/rsyslog/files/rsyslog.conf +116 -0
  20. data/examples/modules/rsyslog/manifests/init.pp +15 -0
  21. data/examples/modules/sinatra/manifests/init.pp +9 -0
  22. data/examples/modules/web/files/monitor/app.rb +55 -0
  23. data/examples/modules/web/files/monitor/config.ru +2 -0
  24. data/examples/modules/web/files/monitor/haproxy.cfg.erb +50 -0
  25. data/examples/modules/web/manifests/init.pp +26 -0
  26. data/examples/simple.rb +58 -0
  27. data/lib/bfire/aggregator/zabbix.rb +55 -0
  28. data/lib/bfire/engine.rb +546 -0
  29. data/lib/bfire/group.rb +241 -0
  30. data/lib/bfire/metric.rb +36 -0
  31. data/lib/bfire/provider/puppet.rb +58 -0
  32. data/lib/bfire/pub_sub/publisher.rb +40 -0
  33. data/lib/bfire/rule.rb +110 -0
  34. data/lib/bfire/template.rb +142 -0
  35. data/lib/bfire/version.rb +3 -0
  36. data/lib/bfire.rb +10 -0
  37. metadata +241 -0
data/LICENSE ADDED
File without changes
data/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # bfire
2
+ A powerful DSL to launch experiments on BonFIRE.
3
+
4
+ What this does for you:
5
+
6
+ * Nice DSL to declare the resources you want;
7
+ * Groups compute resources into... groups;
8
+ * Supports dependencies between groups, and builds the dependency graph to launch groups in the right order;
9
+ * Provision software on compute resources using [Puppet](http://www.puppetlabs.com/);
10
+ * Provides hooks after each deployment step so that you can launch your own commands;
11
+ * Abstracts SSH connections, including connections going through gateways;
12
+ * Registers metrics into Zabbix;
13
+ * Scale up or scale down groups based on any condition you want, including metric values.
14
+
15
+ This is very much a work in progress, and a proof of concept.
16
+ The code is definitely not something you want to look at.
17
+
18
+ ## Usage
19
+
20
+ $ bfire my-experiment.rb
21
+
22
+ Or, if you are developing in the project's directory:
23
+
24
+ $ git clone git://github.com/crohr/bfire.git
25
+ $ cd bfire/
26
+ $ ruby -I lib/ bin/bfire my-experiment.rb
27
+
28
+ Content of `my-experiment.rb`:
29
+
30
+ set :name, "Simple Experiment using bfire"
31
+ set :walltime, 3600
32
+ set :gateway, "ssh.bonfire.grid5000.fr"
33
+ set :user, ENV['USER']
34
+ set :logging, INFO
35
+
36
+ set :squeeze, "BonFIRE Debian Squeeze 2G v1"
37
+ set :zabbix, "BonFIRE Zabbix Aggregator v2"
38
+ set :wan, "BonFIRE WAN"
39
+
40
+ group :monitor do
41
+ at "uk-epcc"
42
+ instance_type "small"
43
+ deploy conf[:zabbix]
44
+ connect_to conf[:wan]
45
+ end
46
+
47
+ group :servers do
48
+ at "fr-inria"
49
+ instance_type "small"
50
+ deploy conf[:squeeze]
51
+ connect_to conf[:wan]
52
+
53
+ # This is not a runtime dependency, it starts right after the resources in
54
+ # the monitor group have been _created_ (they're not necessarily _running_).
55
+ depends_on :monitor do |group|
56
+ {:aggregator_ip => group.take(:first)['nic'][0]['ip']}
57
+ end
58
+ end
59
+
60
+ group :clients do
61
+ at "fr-inria"
62
+ at "de-hlrs"
63
+ instance_type "small"
64
+ deploy conf[:squeeze]
65
+ connect_to conf[:wan]
66
+
67
+ depends_on :monitor do |group|
68
+ {:aggregator_ip => group.take(:first)['nic'][0]['ip']}
69
+ end
70
+ depends_on :servers do |group|
71
+ {:server_ips => group.map{|vm| vm['nic'][0]['ip']}}
72
+ end
73
+
74
+ on :launched do
75
+ puts "Yeah, our resources have been launched!"
76
+ end
77
+
78
+ # The ready event is generated once the group resources are launched AND
79
+ # ssh accessible.
80
+ on :ready do |group|
81
+ group.each{|vm|
82
+ puts "#{group.banner}#{vm['name']} - #{vm['nic'][0]['ip']}"
83
+ }
84
+ end
85
+ end
86
+
87
+ See the `examples` directory for up to date examples.
88
+
89
+ ## Authors
90
+ * Cyril Rohr <cyril.rohr@inria.fr>
data/bin/bfire ADDED
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env ruby
2
+ require 'bfire'
3
+ require 'optparse'
4
+ require 'logger'
5
+ require 'pp'
6
+
7
+ logger = Logger.new(STDERR)
8
+ logger.level = Logger.const_get(ENV['DEBUG'] || "WARN")
9
+
10
+ @options = {
11
+ :logger => logger,
12
+ :restfully_config => File.expand_path(
13
+ "~/.restfully/api.bonfire-project.eu"
14
+ )
15
+ }
16
+
17
+ filename = ARGV[0]
18
+ if filename.nil?
19
+ dir = File.dirname(Dir.pwd)
20
+ dsl = ""
21
+ while line = gets do
22
+ dsl << line
23
+ end
24
+ else
25
+ dir = File.dirname(filename)
26
+ dsl = File.read(filename)
27
+ end
28
+
29
+ engine = Bfire::Engine.new(:root => dir)
30
+ engine.instance_eval(dsl)
31
+
32
+ option_parser = OptionParser.new do |opts|
33
+ opts.banner = <<BANNER
34
+ * Description
35
+ bfire: Launch experiments on BonFIRE.
36
+
37
+ * Usage
38
+ $ bfire engine-file
39
+
40
+ * Options
41
+ BANNER
42
+
43
+ opts.on("-a=", "--authorized-keys=", "Specify an authorized_keys file to use instead of your public key [default=#{engine.conf[:authorized_keys]}].") do |v|
44
+ authorized_keys = File.expand_path(v)
45
+ if File.file?(authorized_keys) && File.readable?(authorized_keys)
46
+ @options[:authorized_keys] = authorized_keys
47
+ else
48
+ fail "Cannot find your authorized_keys file at #{authorized_keys.inspect}"
49
+ end
50
+ end
51
+ opts.on("-c=", "--config=", "Pass the Restfully YAML configuration file. See <https://github.com/crohr/restfully>.") do |v|
52
+ @options[:restfully_config] = File.expand_path(v)
53
+ end
54
+ opts.on("-u=", "--user=", "Specify your BonFIRE username [default=#{engine.conf[:user]}].") do |v|
55
+ @options[:user] = v
56
+ end
57
+ opts.on("-g=", "--gateway=", "Issues SSH commands via the specified gateway [default=#{engine.conf[:gateway]}].") do |v|
58
+ @options[:gateway] = v
59
+ end
60
+ opts.on("-w=", "--walltime=", "Specify the walltime for the experiment (in seconds) [default=#{engine.conf[:walltime]}].") do |v|
61
+ @options[:walltime] = v.to_i
62
+ end
63
+ opts.on("-k=", "--key=", "Specify the private key to use [default=#{engine.conf[:key]}].") do |v|
64
+ public_key = File.expand_path(v+".pub")
65
+ if File.file?(public_key) && File.readable?(public_key)
66
+ @options[:key] = v
67
+ # public_key can already be set by --authorized-keys-file,
68
+ # don't override:
69
+ @options[:authorized_keys] ||= public_key
70
+ else
71
+ fail "Cannot find the public part of your SSH key at #{public_key.inspect}"
72
+ end
73
+ end
74
+ {
75
+ :no_cleanup => "Do not delete experiment at the end.",
76
+ :no_cancel => "Do not delete experiment at the end, even if an error occurs.",
77
+ }.each do |flag, description|
78
+ opts.on("--#{flag.to_s.gsub('_','-')}", description) do |v|
79
+ @options[flag] = true
80
+ end
81
+ end
82
+ opts.on("--dev", "Attempts to reuse an existing experiment with the same name, in the running state.") do |v|
83
+ @options[:dev] = true
84
+ end
85
+ opts.on("--name=", "Name for your experiment [default=#{engine.conf[:name]}].") do |v|
86
+ @options[:name] = v
87
+ end
88
+ # opts.on("--log=", "Outputs log messages to the given file. Defaults to STDERR.") do |v|
89
+ # original_logger_level = logger.level
90
+ # logger = Logger.new(File.expand_path(v))
91
+ # logger.level = original_logger_level
92
+ # @options[:logger] = logger
93
+ # end
94
+ opts.on("--debug", "Set the logging level (DEBUG,INFO,WARN,ERROR,UNKNOWN) [default=#{engine.conf[:logging]}].") do |v|
95
+ @options[:logging] = Logger.const_get(v.to_s.upcase)
96
+ end
97
+ opts.on("--version", "Display the version.") do |v|
98
+ puts Bfire::VERSION
99
+ exit(0)
100
+ end
101
+ opts.on_tail("-h", "--help", "Show this message.") do
102
+ puts opts
103
+ exit(0)
104
+ end
105
+
106
+ end
107
+
108
+
109
+ begin
110
+ option_parser.parse!
111
+ @options.each do |k,v|
112
+ engine.set(k, v)
113
+ end
114
+
115
+ engine.run!
116
+ rescue OptionParser::ParseError => e
117
+ STDERR.puts "Error when parsing the options: #{e.message} (#{e.class.name})"
118
+ exit(1)
119
+ end
120
+
@@ -0,0 +1,18 @@
1
+ # $ bfire simple.rb
2
+
3
+ set :name, "Benchmark using bfire"
4
+ set :walltime, 3600
5
+ set :gateway, "ssh.bonfire.grid5000.fr"
6
+ set :user, ENV['USER']
7
+ set :logging, INFO
8
+
9
+ set :squeeze, "BonFIRE Debian Squeeze 2G v2"
10
+ set :wan, "BonFIRE WAN"
11
+
12
+ group :servers do
13
+ at "fr-inria"
14
+ instance_type "lite"
15
+ deploy conf[:squeeze]
16
+ connect_to conf[:wan]
17
+ scale 1..100, :initial => 2
18
+ end
data/examples/dag.rb ADDED
@@ -0,0 +1,26 @@
1
+
2
+ group :c do
3
+ depends_on :a
4
+ depends_on :b
5
+ end
6
+
7
+ group :f do
8
+ depends_on :c
9
+ end
10
+
11
+ group :a do
12
+
13
+ end
14
+
15
+ group :b do
16
+
17
+ end
18
+
19
+
20
+ group :d do
21
+ depends_on :c
22
+ end
23
+
24
+ group :e do
25
+ depends_on :d
26
+ end
@@ -0,0 +1,105 @@
1
+ # $ bfire elasticity.rb
2
+
3
+ # Define global properties
4
+ set :name, "BonFIRE elasticity experiment"
5
+ set :key, "~/.ssh/id_rsa"
6
+ set :authorized_keys, "~/.ssh/authorized_keys"
7
+ set :walltime, 3600
8
+ set :gateway, "ssh.bonfire.grid5000.fr"
9
+ set :user, ENV['USER']
10
+ set :logging, INFO
11
+
12
+ set :squeeze, "BonFIRE Debian Squeeze 2G v2"
13
+ set :zabbix, "BonFIRE Zabbix Aggregator v4"
14
+ set :wan, "BonFIRE WAN"
15
+
16
+
17
+ # Monitoring
18
+ group :eye, :tag => "BonFIRE-monitor" do
19
+ at "fr-inria"
20
+ instance_type "small"
21
+ deploy conf[:zabbix]
22
+ connect_to conf[:wan]
23
+ end
24
+
25
+ # HTTP Routing
26
+ group :web do
27
+ at "fr-inria"
28
+ instance_type 'small'
29
+ deploy conf[:squeeze]
30
+ # Two interfaces for the publicly facing server
31
+ connect_to conf[:wan]
32
+ connect_to :public
33
+
34
+ provider :puppet,
35
+ :classes => ['common', 'web'],
36
+ :modules => "./modules"
37
+
38
+ depends_on :eye do |g|
39
+ {:aggregator_ip => g.take(:first)['nic'][0]['ip']}
40
+ end
41
+
42
+ # Register custom metrics
43
+ register 'connection_waiting_time',
44
+ :command => "/usr/bin/tail -n 1 /var/log/haproxy.log | cut -d ' ' -f 10 | cut -d '/' -f 2",
45
+ :type => :numeric
46
+ end
47
+
48
+ # App servers
49
+ group :app do
50
+ at "fr-inria"
51
+ at "de-hlrs"
52
+ instance_type "small"
53
+ connect_to conf[:wan]
54
+ deploy conf[:squeeze]
55
+ provider :puppet,
56
+ :classes => ['common', 'app'],
57
+ :modules => "./modules"
58
+
59
+ depends_on :eye do |g|
60
+ {:aggregator_ip => g.take(:first)['nic'][0]['ip']}
61
+ end
62
+
63
+ depends_on :web do |g|
64
+ {:router_ip => g.take(:first)['nic'][0]['ip']}
65
+ end
66
+
67
+ # Scaling
68
+ scale 1..10, {
69
+ :initial => 2,
70
+ :up => lambda {|engine|
71
+ values = engine.metric("connection_waiting_time",
72
+ :hosts => engine.group(:web).take(:first),
73
+ :type => :numeric
74
+ ).values[0..3]
75
+ puts "Metric values: #{values.inspect}, avg=#{values.avg.inspect}"
76
+ values.avg >= 600
77
+ },
78
+ :down => lambda {|engine|
79
+ engine.metric("connection_waiting_time",
80
+ :hosts => engine.group(:web).take(:first),
81
+ :type => :numeric
82
+ ).values[0..5].avg < 200
83
+ },
84
+ :period => 90,
85
+ :placement => :round_robin
86
+ }
87
+ end
88
+
89
+ # All groups are "ready", launch an HTTP benchmarking tool against web's first
90
+ # resource on public interface:
91
+ on :ready do
92
+ sleep 20
93
+ cmd = "ab -r -c 8 -n 10000 http://#{group(:web).first['nic'].find{|n| n['ip'] =~ /^131/}['ip']}/delay?delay=0.3"
94
+ puts "***********"
95
+ puts cmd
96
+ system cmd
97
+ end
98
+
99
+ # Define your networks
100
+ network :public do |name, location|
101
+ case location['name']
102
+ when "fr-inria"
103
+ location.networks.find{|network| network['name'] =~ /Public Network/i}
104
+ end
105
+ end
data/examples/ibbt.rb ADDED
@@ -0,0 +1,125 @@
1
+ # $ bfire elasticity.rb
2
+
3
+ # Define global properties
4
+ set :name, "BonFIRE elasticity experiment"
5
+ set :key, "~/.ssh/demo"
6
+ set :authorized_keys, "~/.ssh/demo.pub"
7
+ set :walltime, 4*3600
8
+ set :gateway, "ssh.bonfire.grid5000.fr"
9
+ set :user, ENV['USER']
10
+ set :logging, DEBUG
11
+
12
+ set :squeeze, "BonFIRE Debian Squeeze 2G v2"
13
+ set :zabbix, "BonFIRE Zabbix Aggregator v4"
14
+ set :wan, "BonFIRE WAN"
15
+
16
+
17
+ # Monitoring
18
+ group :eye, :tag => "BonFIRE-monitor" do
19
+ at "fr-inria"
20
+ instance_type "small"
21
+ deploy conf[:zabbix]
22
+ connect_to conf[:wan]
23
+ end
24
+
25
+ # HTTP Routing
26
+ # group :web do
27
+ # at "fr-inria"
28
+ # instance_type 'small'
29
+ # deploy conf[:squeeze]
30
+ # # Two interfaces for the publicly facing server
31
+ # connect_to conf[:wan]
32
+ # connect_to :public
33
+ #
34
+ # provider :puppet,
35
+ # :classes => ['common', 'web'],
36
+ # :modules => "./modules"
37
+ #
38
+ # depends_on :eye do |g|
39
+ # {:aggregator_ip => g.take(:first)['nic'][0]['ip']}
40
+ # end
41
+ #
42
+ # # Register custom metrics
43
+ # register 'connection_waiting_time',
44
+ # :command => "/usr/bin/tail -n 1 /var/log/haproxy.log | cut -d ' ' -f 10 | cut -d '/' -f 2",
45
+ # :type => :numeric
46
+ # end
47
+
48
+ group :servers do
49
+ at "be-ibbt"
50
+ connect_to conf[:wan]
51
+ connect_to :private
52
+ deploy "BonFIRE Debian Squeeze v1"
53
+ instance_type "small"
54
+ end
55
+
56
+ # App servers
57
+ group :clients do
58
+ at "be-ibbt"
59
+ instance_type "small"
60
+ connect_to :private
61
+ deploy "BonFIRE Debian Squeeze v1"
62
+ # provider :puppet,
63
+ # :classes => ['common', 'app'],
64
+ # :modules => "./modules"
65
+
66
+ depends_on :eye do |g|
67
+ {:aggregator_ip => g.take(:first)['nic'][0]['ip']}
68
+ end
69
+
70
+ depends_on :servers do |g|
71
+ {:iperf_server => g.take(:first)['nic'][0]['ip']}
72
+ end
73
+
74
+ # Scaling
75
+ scale 1..10, {
76
+ :initial => 2,
77
+ # :up => lambda {|engine|
78
+ # values = engine.metric("connection_waiting_time",
79
+ # :hosts => engine.group(:web).take(:first),
80
+ # :type => :numeric
81
+ # ).values[0..3]
82
+ # puts "Metric values: #{values.inspect}, avg=#{values.avg.inspect}"
83
+ # values.avg >= 600
84
+ # },
85
+ # :down => lambda {|engine|
86
+ # engine.metric("connection_waiting_time",
87
+ # :hosts => engine.group(:web).take(:first),
88
+ # :type => :numeric
89
+ # ).values[0..5].avg < 200
90
+ # },
91
+ # :period => 90,
92
+ :placement => :round_robin
93
+ }
94
+ end
95
+
96
+ # All groups are "ready", launch an HTTP benchmarking tool against web's first
97
+ # resource on public interface:
98
+ # on :ready do
99
+ # sleep 20
100
+ # cmd = "ab -r -c 8 -n 10000 http://#{group(:web).first['nic'].find{|n| n['ip'] =~ /^131/}['ip']}/delay?delay=0.3"
101
+ # puts "***********"
102
+ # puts cmd
103
+ # system cmd
104
+ # end
105
+
106
+ network :private do |name, location, experiment|
107
+ experiment.networks.submit(
108
+ :location => location,
109
+ :name => "network-experiment#{experiment['id']}",
110
+ :bandwidth => 10,
111
+ :latency => 0,
112
+ :size => 24,
113
+ :lossrate => 0,
114
+ # You MUST specify the address:
115
+ :address => "192.168.0.1"
116
+ )
117
+ end
118
+
119
+ # Define your networks
120
+ # network :public do |name, location|
121
+ # case location['name']
122
+ # when "fr-inria"
123
+ # location.networks.find{|network| network['name'] =~ /Public Network/i}
124
+ # end
125
+ # end
data/examples/mine.rb ADDED
@@ -0,0 +1,40 @@
1
+ use Bfire::API::Bonfire, {
2
+ :username => "crohr",
3
+ :password => "toto",
4
+ :gateway => "ssh.bonfire.grid5000.fr"
5
+ }
6
+
7
+ set :debug, INFO
8
+
9
+ set :walltime, 3600
10
+ set :logging, INFO
11
+
12
+ set :squeeze, "BonFIRE Debian Squeeze 2G v1"
13
+ set :zabbix, "BonFIRE Zabbix Aggregator v2"
14
+ set :wan, "BonFIRE WAN"
15
+
16
+
17
+ group :app do
18
+ attach :db4g
19
+
20
+ at "fr-inria" do
21
+ type "lite"
22
+ connect "BonFIRE WAN"
23
+ connect :private
24
+ end
25
+
26
+ at "us-eastc1" do
27
+ type "t1.micro"
28
+ end
29
+ end
30
+
31
+
32
+ network :private do
33
+ visibility :private
34
+ cidr "192.168.0.0/24"
35
+ end
36
+
37
+ storage :db4g do
38
+ size 4.GB
39
+ fstype "ext3"
40
+ end
@@ -0,0 +1,44 @@
1
+ class apache2 {
2
+ include "apache2::${operatingsystem}"
3
+ }
4
+
5
+ # Class: apache2::debian
6
+ #
7
+ #
8
+ class apache2::debian {
9
+ package { "apache2":
10
+ ensure => installed,
11
+ }
12
+
13
+ service { "apache2":
14
+ ensure => running,
15
+ enable => true,
16
+ require => Package["apache2"];
17
+ }
18
+ }
19
+
20
+ # Class: apache2::ubuntu
21
+ #
22
+ #
23
+ class apache2::ubuntu {
24
+ include apache2::debian
25
+ }
26
+
27
+ # Class: apache2::centos
28
+ #
29
+ #
30
+ class apache2::centos {
31
+ package { "httpd":
32
+ ensure => installed,
33
+ }
34
+
35
+ service { "httpd":
36
+ ensure => running,
37
+ enable => true,
38
+ require => Package["httpd"];
39
+ }
40
+ }
41
+
42
+
43
+
44
+
@@ -0,0 +1,29 @@
1
+ require 'sinatra'
2
+
3
+ def registered?
4
+ cmd = '. /etc/default/bonfire && curl -f http://$ROUTER_IP:8000/hosts -X POST -d "ip=$WAN_IP"'
5
+ system(cmd)
6
+ $?.exitstatus == 0
7
+ rescue Exception => e
8
+ puts "Received #{e.class.name}: #{e.message}"
9
+ false
10
+ end
11
+
12
+ Thread.new{
13
+ # Register with the server on launch
14
+ # Not efficient but works
15
+ until registered? do
16
+ puts "ROUTER not ready yet."
17
+ sleep 3
18
+ end
19
+ }
20
+
21
+ get '/' do
22
+ "UP"
23
+ end
24
+
25
+ get '/delay' do
26
+ delay = (params[:delay] || 0).to_f
27
+ sleep delay
28
+ "Slept for #{delay}s."
29
+ end
@@ -0,0 +1,2 @@
1
+ require 'app'
2
+ run Sinatra::Application
@@ -0,0 +1,4 @@
1
+ <?
2
+ sleep($_GET['sleep']);
3
+ print("Hello");
4
+ ?>
@@ -0,0 +1,19 @@
1
+ class app {
2
+ include sinatra
3
+
4
+ file{"/tmp/app":
5
+ recurse => true,
6
+ source => "puppet:///modules/app/app",
7
+ notify => Service["myapp"]
8
+ }
9
+
10
+ service{"myapp":
11
+ ensure => running,
12
+ start => "/usr/bin/thin -d -l /var/log/thin.log -p 80 -R config.ru -c /tmp/app --tag myapp start",
13
+ stop => "/usr/bin/thin -d -l /var/log/thin.log -p 80 -R config.ru -c /tmp/app --tag myapp stop",
14
+ require => [
15
+ Package["libsinatra-ruby"],
16
+ File["/tmp/app"]
17
+ ]
18
+ }
19
+ }
@@ -0,0 +1,8 @@
1
+ class common {
2
+ package{"curl":
3
+ ensure => installed
4
+ }
5
+ package{"vim":
6
+ ensure => installed
7
+ }
8
+ }
@@ -0,0 +1,4 @@
1
+ # Set ENABLED to 1 if you want the init script to start haproxy.
2
+ ENABLED=1
3
+ # Add extra flags here.
4
+ #EXTRAOPTS="-de -m 16"
@@ -0,0 +1,2 @@
1
+ local0.* /var/log/haproxy.log
2
+ # local0.* -/var/log/syslog
@@ -0,0 +1,21 @@
1
+ class haproxy {
2
+ include rsyslog
3
+
4
+ package{"haproxy":
5
+ ensure => installed
6
+ }
7
+ service{"haproxy":
8
+ ensure => running,
9
+ require => Package["haproxy"]
10
+ }
11
+ file{"/etc/default/haproxy":
12
+ source => "puppet:///modules/haproxy/default",
13
+ require => Package["haproxy"],
14
+ notify => Service["haproxy"]
15
+ }
16
+ file{"/etc/rsyslog.d/haproxy.conf":
17
+ source => "puppet:///modules/haproxy/haproxy.rsyslog.conf",
18
+ require => [Package["rsyslog"], Package["haproxy"]],
19
+ notify => Service["rsyslog"]
20
+ }
21
+ }