dust-deploy 0.14.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,16 @@
1
1
  Changelog
2
2
  =============
3
3
 
4
+ 0.14.1
5
+ ------------
6
+
7
+ - removes ntpd recipe
8
+ - adds chrony recipe
9
+
10
+ recipes:
11
+ chrony: enabled
12
+
13
+
4
14
  0.14.0
5
15
  ------------
6
16
 
@@ -0,0 +1,71 @@
1
+ class Chrony < Recipe
2
+ desc 'chrony:deploy', 'installs and configures chrony'
3
+ def deploy
4
+ # warn if other ntp package is installed
5
+ [ 'openntpd', 'ntp' ].each do |package|
6
+ if @node.package_installed?(package, :quiet => true)
7
+ @node.messages.add("#{package} installed, might conflict with chrony, might get deleted").warning
8
+ end
9
+ end
10
+
11
+ # install package
12
+ @node.install_package('chrony')
13
+
14
+ # set config file and service name according to distribution used
15
+ if @node.uses_apt?
16
+ config = '/etc/chrony/chrony.conf'
17
+ service = 'chrony'
18
+ elsif @node.uses_rpm?
19
+ config = '/etc/chrony.conf'
20
+ service = 'chronyd'
21
+ end
22
+
23
+ @node.write(config, generate_config)
24
+
25
+ @node.autostart_service(service)
26
+ @node.restart_service(service) if options.restart?
27
+ end
28
+
29
+
30
+ private
31
+
32
+ # generate chrony.conf
33
+ def generate_config
34
+ @config = default_options.merge(@config)
35
+ file = ''
36
+ @config.each do |key, value|
37
+ Array(value).each { |v| file << "#{key} #{v}\n" }
38
+ end
39
+ file
40
+ end
41
+
42
+ # default chrony.conf options
43
+ def default_options
44
+ options = {
45
+ 'server' => [
46
+ '0.pool.ntp.org minpoll 8',
47
+ '1.pool.ntp.org minpoll 8',
48
+ '2.pool.ntp.org minpoll 8',
49
+ '3.pool.ntp.org minpoll 8'
50
+ ],
51
+ 'commandkey' => 1,
52
+ 'logdir' => '/var/log/chrony',
53
+ 'logchange' => 0.5,
54
+ 'maxupdateskew' => 100.0, # Stop bad estimates upsetting machine clock.
55
+ 'dumponexit' => '', # Dump measurements when daemon exits.
56
+ 'dumpdir' => '/var/lib/chrony',
57
+ 'rtconutc' => '' # CMOS clock is on UTC (GMT)
58
+ }
59
+
60
+ if @node.uses_rpm?
61
+ options['keyfile'] = '/etc/chrony.keys'
62
+ options['driftfile'] = '/var/lib/chrony/drift'
63
+ elsif @node.uses_apt?
64
+ options['keyfile'] = '/etc/chrony/chrony.keys'
65
+ options['driftfile'] = '/var/lib/chrony/chrony.drift'
66
+ end
67
+
68
+ options
69
+ end
70
+ end
71
+
@@ -1,3 +1,3 @@
1
1
  module Dust
2
- VERSION = "0.14.0"
2
+ VERSION = "0.14.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dust-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-20 00:00:00.000000000 Z
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -169,6 +169,7 @@ files:
169
169
  - lib/dust/recipe.rb
170
170
  - lib/dust/recipes/aliases.rb
171
171
  - lib/dust/recipes/apt.rb
172
+ - lib/dust/recipes/chrony.rb
172
173
  - lib/dust/recipes/cjdroute.rb
173
174
  - lib/dust/recipes/cron.rb
174
175
  - lib/dust/recipes/cups_client.rb
@@ -187,7 +188,6 @@ files:
187
188
  - lib/dust/recipes/mysql.rb
188
189
  - lib/dust/recipes/newrelic.rb
189
190
  - lib/dust/recipes/nginx.rb
190
- - lib/dust/recipes/ntpd.rb
191
191
  - lib/dust/recipes/pacemaker.rb
192
192
  - lib/dust/recipes/packages.rb
193
193
  - lib/dust/recipes/postfix.rb
@@ -1,19 +0,0 @@
1
- class Ntpd < Recipe
2
- desc 'ntpd:deploy', 'installs and configures ntpd'
3
- def deploy
4
- # warn if other ntp package is installed
5
- [ 'openntpd', 'chrony' ].each do |package|
6
- if @node.package_installed? package, :quiet => true
7
- @node.messages.add("#{package} installed, might conflict with ntpd, might get deleted").warning
8
- end
9
- end
10
-
11
- @node.install_package 'ntp'
12
-
13
- service = @node.uses_apt? ? 'ntp' : 'ntpd'
14
-
15
- @node.autostart_service service
16
- @node.restart_service service if options.restart?
17
- end
18
- end
19
-