puppet 0.16.0 → 0.18.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +98 -0
- data/Rakefile +5 -1
- data/bin/puppet +1 -1
- data/bin/puppetca +25 -11
- data/bin/puppetd +189 -66
- data/bin/puppetdoc +79 -62
- data/bin/puppetmasterd +93 -49
- data/bin/puppetrun +385 -0
- data/conf/redhat/client.init +5 -2
- data/conf/redhat/fileserver.conf +1 -1
- data/conf/redhat/lsb-config.patch +51 -0
- data/conf/redhat/puppet.spec +45 -18
- data/conf/redhat/puppetd.conf +32 -4
- data/conf/redhat/server.init +5 -2
- data/conf/solaris/pkginfo +7 -0
- data/conf/solaris/smf/puppetd.xml +77 -0
- data/conf/solaris/smf/puppetmasterd.xml +77 -0
- data/conf/solaris/smf/svc-puppetd +66 -0
- data/conf/solaris/smf/svc-puppetmasterd +62 -0
- data/examples/code/failers/noobjectrvalue +1 -0
- data/examples/code/snippets/deepclassheirarchy.pp +23 -0
- data/examples/code/snippets/defineoverrides.pp +17 -0
- data/examples/code/snippets/emptyexec.pp +3 -0
- data/examples/code/snippets/selectorvalues.pp +6 -1
- data/examples/code/snippets/tagged.pp +35 -0
- data/ext/ldap/puppet.schema +2 -2
- data/install.rb +4 -2
- data/lib/puppet.rb +206 -15
- data/lib/puppet/client.rb +30 -20
- data/lib/puppet/client/ca.rb +2 -2
- data/lib/puppet/client/dipper.rb +5 -9
- data/lib/puppet/client/master.rb +224 -44
- data/lib/puppet/client/pelement.rb +54 -9
- data/lib/puppet/client/proxy.rb +3 -2
- data/lib/puppet/client/reporter.rb +34 -0
- data/lib/puppet/client/runner.rb +17 -0
- data/lib/puppet/config.rb +136 -55
- data/lib/puppet/daemon.rb +59 -37
- data/lib/puppet/element.rb +2 -1
- data/lib/puppet/event.rb +14 -3
- data/lib/puppet/filetype.rb +28 -19
- data/lib/puppet/log.rb +297 -132
- data/lib/puppet/metric.rb +31 -131
- data/lib/puppet/networkclient.rb +73 -46
- data/lib/puppet/parameter.rb +49 -1
- data/lib/puppet/parsedfile.rb +32 -12
- data/lib/puppet/parser/ast.rb +6 -1
- data/lib/puppet/parser/ast/astarray.rb +32 -6
- data/lib/puppet/parser/ast/collection.rb +91 -0
- data/lib/puppet/parser/ast/compdef.rb +2 -2
- data/lib/puppet/parser/ast/component.rb +24 -11
- data/lib/puppet/parser/ast/function.rb +50 -0
- data/lib/puppet/parser/ast/hostclass.rb +70 -22
- data/lib/puppet/parser/ast/node.rb +17 -8
- data/lib/puppet/parser/ast/nodedef.rb +1 -1
- data/lib/puppet/parser/ast/objectdef.rb +28 -10
- data/lib/puppet/parser/ast/selector.rb +4 -1
- data/lib/puppet/parser/functions.rb +145 -0
- data/lib/puppet/parser/interpreter.rb +243 -86
- data/lib/puppet/parser/lexer.rb +5 -4
- data/lib/puppet/parser/parser.rb +586 -505
- data/lib/puppet/parser/scope.rb +337 -187
- data/lib/puppet/rails.rb +115 -0
- data/lib/puppet/rails/database.rb +40 -0
- data/lib/puppet/rails/host.rb +83 -0
- data/lib/puppet/rails/rails_object.rb +42 -0
- data/lib/puppet/rails/rails_parameter.rb +5 -0
- data/lib/puppet/reports/rrdgraph.rb +20 -0
- data/lib/puppet/reports/tagmail.rb +94 -0
- data/lib/puppet/server.rb +20 -4
- data/lib/puppet/server/authconfig.rb +14 -3
- data/lib/puppet/server/authstore.rb +2 -2
- data/lib/puppet/server/ca.rb +23 -11
- data/lib/puppet/server/filebucket.rb +10 -10
- data/lib/puppet/server/fileserver.rb +4 -8
- data/lib/puppet/server/master.rb +19 -22
- data/lib/puppet/server/pelement.rb +28 -16
- data/lib/puppet/server/report.rb +184 -0
- data/lib/puppet/server/runner.rb +62 -0
- data/lib/puppet/server/servlet.rb +23 -9
- data/lib/puppet/sslcertificates/ca.rb +25 -1
- data/lib/puppet/statechange.rb +34 -53
- data/lib/puppet/storage.rb +1 -2
- data/lib/puppet/transaction.rb +305 -133
- data/lib/puppet/transaction/report.rb +42 -0
- data/lib/puppet/transportable.rb +57 -33
- data/lib/puppet/type.rb +260 -127
- data/lib/puppet/type/component.rb +9 -21
- data/lib/puppet/type/cron.rb +367 -116
- data/lib/puppet/type/exec.rb +15 -16
- data/lib/puppet/type/group.rb +9 -1
- data/lib/puppet/type/nameservice.rb +2 -5
- data/lib/puppet/type/nameservice/netinfo.rb +3 -0
- data/lib/puppet/type/nameservice/objectadd.rb +23 -10
- data/lib/puppet/type/nameservice/pw.rb +16 -3
- data/lib/puppet/type/package.rb +25 -75
- data/lib/puppet/type/package/apple.rb +15 -1
- data/lib/puppet/type/package/apt.rb +37 -2
- data/lib/puppet/type/package/blastwave.rb +136 -0
- data/lib/puppet/type/package/dpkg.rb +4 -4
- data/lib/puppet/type/package/gem.rb +119 -0
- data/lib/puppet/type/package/openbsd.rb +7 -6
- data/lib/puppet/type/package/ports.rb +7 -2
- data/lib/puppet/type/package/rpm.rb +1 -1
- data/lib/puppet/type/package/sun.rb +23 -9
- data/lib/puppet/type/package/sunfreeware.rb +7 -0
- data/lib/puppet/type/package/yum.rb +16 -9
- data/lib/puppet/type/parsedtype.rb +7 -5
- data/lib/puppet/type/parsedtype/mount.rb +55 -34
- data/lib/puppet/type/parsedtype/port.rb +7 -1
- data/lib/puppet/type/parsedtype/sshkey.rb +6 -16
- data/lib/puppet/type/pfile.rb +115 -23
- data/lib/puppet/type/pfile/checksum.rb +18 -5
- data/lib/puppet/type/pfile/content.rb +2 -2
- data/lib/puppet/type/pfile/ensure.rb +3 -3
- data/lib/puppet/type/pfile/group.rb +2 -2
- data/lib/puppet/type/pfile/source.rb +28 -17
- data/lib/puppet/type/pfile/target.rb +25 -17
- data/lib/puppet/type/pfilebucket.rb +25 -6
- data/lib/puppet/type/schedule.rb +6 -6
- data/lib/puppet/type/service.rb +24 -14
- data/lib/puppet/type/service/debian.rb +1 -1
- data/lib/puppet/type/service/redhat.rb +13 -10
- data/lib/puppet/type/service/smf.rb +3 -3
- data/lib/puppet/type/state.rb +1 -2
- data/lib/puppet/type/symlink.rb +3 -4
- data/lib/puppet/type/user.rb +22 -10
- data/lib/puppet/type/yumrepo.rb +6 -1
- data/lib/puppet/type/zone.rb +595 -0
- data/lib/puppet/util.rb +58 -12
- data/test/client/client.rb +2 -2
- data/test/client/master.rb +92 -3
- data/test/client/pelement.rb +99 -0
- data/test/executables/puppetbin.rb +3 -4
- data/test/executables/puppetca.rb +3 -3
- data/test/executables/puppetd.rb +3 -3
- data/test/executables/puppetmasterd.rb +1 -5
- data/test/executables/puppetmodule.rb +2 -2
- data/test/language/ast.rb +200 -11
- data/test/language/functions.rb +245 -0
- data/test/language/interpreter.rb +155 -6
- data/test/language/lexer.rb +35 -2
- data/test/language/node.rb +48 -1
- data/test/language/parser.rb +250 -1
- data/test/language/rails.rb +105 -0
- data/test/language/scope.rb +304 -10
- data/test/language/snippets.rb +54 -5
- data/test/language/transportable.rb +60 -28
- data/test/other/config.rb +214 -1
- data/test/other/events.rb +67 -9
- data/test/other/log.rb +31 -5
- data/test/other/metrics.rb +23 -21
- data/test/other/parsedfile.rb +29 -2
- data/test/other/puppet.rb +79 -0
- data/test/other/report.rb +106 -0
- data/test/other/storage.rb +2 -2
- data/test/other/transactions.rb +128 -2
- data/test/puppet/utiltest.rb +10 -5
- data/test/puppettest.rb +193 -21
- data/test/server/authstore.rb +13 -4
- data/test/server/bucket.rb +33 -8
- data/test/server/ca.rb +44 -6
- data/test/server/master.rb +6 -7
- data/test/server/pelement.rb +15 -5
- data/test/server/report.rb +93 -0
- data/test/server/runner.rb +107 -0
- data/test/server/server.rb +28 -1
- data/test/types/cron.rb +339 -31
- data/test/types/file.rb +256 -24
- data/test/types/filebucket.rb +6 -2
- data/test/types/filesources.rb +41 -92
- data/test/types/group.rb +31 -1
- data/test/types/host.rb +2 -1
- data/test/types/mount.rb +18 -1
- data/test/types/package.rb +200 -18
- data/test/types/service.rb +5 -1
- data/test/types/sshkey.rb +2 -1
- data/test/types/symlink.rb +3 -2
- data/test/types/type.rb +180 -1
- data/test/types/user.rb +65 -27
- data/test/types/yumrepo.rb +15 -0
- data/test/types/zone.rb +437 -0
- metadata +43 -4
- data/bin/cf2puppet +0 -186
- data/conf/redhat/puppetmasterd.conf +0 -5
data/bin/puppetrun
ADDED
@@ -0,0 +1,385 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#
|
4
|
+
# = Synopsis
|
5
|
+
#
|
6
|
+
# Trigger a puppetd run on a set of hosts.
|
7
|
+
#
|
8
|
+
# = Usage
|
9
|
+
#
|
10
|
+
# puppetrun [-a|--all] [-c|--class <class>] [-d|--debug] [-f|--foreground]
|
11
|
+
# [-h|--help] [--host <host>] [--no-fqdn] [--ignoreschedules]
|
12
|
+
# [-t|--tag <tag>] [--test]
|
13
|
+
#
|
14
|
+
# = Description
|
15
|
+
#
|
16
|
+
# This script can be used to connect to a set of machines running +puppetd+
|
17
|
+
# and trigger them to run their configurations. The most common usage would
|
18
|
+
# be to specify a class of hosts and a set of tags, and +puppetrun+ would
|
19
|
+
# look up in LDAP all of the hosts matching that class, then connect to
|
20
|
+
# each host and trigger a run of all of the objects with the specified tags.
|
21
|
+
#
|
22
|
+
# If you are not storing your host configurations in LDAP, you can specify
|
23
|
+
# hosts manually.
|
24
|
+
#
|
25
|
+
# You will most likely have to run +puppetrun+ as root to get access to
|
26
|
+
# the SSL certificates.
|
27
|
+
#
|
28
|
+
# +puppetrun+ reads +puppetmaster+'s configuration file, so that it can copy
|
29
|
+
# things like LDAP settings.
|
30
|
+
#
|
31
|
+
# = Usage Notes
|
32
|
+
#
|
33
|
+
# +puppetrun+ is useless unless +puppetd+ is listening. See its documentation
|
34
|
+
# for more information, but the gist is that you must enable +listen+ on the
|
35
|
+
# +puppetd+ daemon, either using +--listen+ on the command line or adding
|
36
|
+
# 'listen: true' in its config file. In addition, you need to set the daemons
|
37
|
+
# up to specifically allow connections by creating the +namespaceauth+ file,
|
38
|
+
# normally at '/etc/puppet/namespaceauth.conf'. This file specifies who has
|
39
|
+
# access to each namespace; if you create the file you must add every namespace
|
40
|
+
# you want any Puppet daemon to allow -- it is currently global to all Puppet
|
41
|
+
# daemons.
|
42
|
+
#
|
43
|
+
# An example file looks like this:
|
44
|
+
#
|
45
|
+
# [fileserver]
|
46
|
+
# allow *.madstop.com
|
47
|
+
#
|
48
|
+
# [puppetmaster]
|
49
|
+
# allow *.madstop.com
|
50
|
+
#
|
51
|
+
# [puppetrunner]
|
52
|
+
# allow culain.madstop.com
|
53
|
+
#
|
54
|
+
# This is what you would install on your Puppet master; non-master hosts could
|
55
|
+
# leave off the 'fileserver' and 'puppetmaster' namespaces.
|
56
|
+
#
|
57
|
+
# Expect more documentation on this eventually.
|
58
|
+
#
|
59
|
+
# = Options
|
60
|
+
#
|
61
|
+
# Note that any configuration parameter that's valid in the configuration file
|
62
|
+
# is also a valid long argument. For example, 'ssldir' is a valid configuration
|
63
|
+
# parameter, so you can specify '--ssldir <directory>' as an argument.
|
64
|
+
#
|
65
|
+
# See the configuration file for the full list of acceptable parameters.
|
66
|
+
#
|
67
|
+
# all::
|
68
|
+
# Connect to all available hosts. Requires LDAP support at this point.
|
69
|
+
#
|
70
|
+
# class::
|
71
|
+
# Specify a class of machines to which to connect. This only works if you
|
72
|
+
# have LDAP configured, at the moment.
|
73
|
+
#
|
74
|
+
# debug::
|
75
|
+
# Enable full debugging.
|
76
|
+
#
|
77
|
+
# foreground::
|
78
|
+
# Run each configuration in the foreground; that is, when connecting to a host,
|
79
|
+
# do not return until the host has finished its run. The default is false.
|
80
|
+
#
|
81
|
+
# help::
|
82
|
+
# Print this help message
|
83
|
+
#
|
84
|
+
# host::
|
85
|
+
# A specific host to which to connect. This flag can be specified more
|
86
|
+
# than once.
|
87
|
+
#
|
88
|
+
# ignoreschedules::
|
89
|
+
# Whether the client should ignore schedules when running its configuration.
|
90
|
+
# This can be used to force the client to perform work it would not normally
|
91
|
+
# perform so soon. The default is false.
|
92
|
+
#
|
93
|
+
# parallel::
|
94
|
+
# How parallel to make the connections. Parallelization is provided by forking
|
95
|
+
# for each client to which to connect. The default is 1, meaning serial execution.
|
96
|
+
#
|
97
|
+
# tag::
|
98
|
+
# Specify a tag for selecting the objects to apply.
|
99
|
+
#
|
100
|
+
# test::
|
101
|
+
# Print the hosts you would connect to but do not actually connect.
|
102
|
+
#
|
103
|
+
# = Example
|
104
|
+
#
|
105
|
+
# sudo puppetrun -p 10 --host host1 --host host2 -t remotefile -t webserver
|
106
|
+
#
|
107
|
+
# = Author
|
108
|
+
#
|
109
|
+
# Luke Kanies
|
110
|
+
#
|
111
|
+
# = Copyright
|
112
|
+
#
|
113
|
+
# Copyright (c) 2005 Reductive Labs, LLC
|
114
|
+
# Licensed under the GNU Public License
|
115
|
+
|
116
|
+
[:INT, :TERM].each do |signal|
|
117
|
+
trap(signal) do
|
118
|
+
$stderr.puts "Cancelling"
|
119
|
+
exit(1)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
require 'ldap'
|
123
|
+
require 'puppet'
|
124
|
+
require 'puppet/server'
|
125
|
+
require 'puppet/client'
|
126
|
+
require 'getoptlong'
|
127
|
+
|
128
|
+
|
129
|
+
# Look up all nodes matching a given class in LDAP.
|
130
|
+
def ldapnodes(klass, fqdn = true)
|
131
|
+
unless defined? @ldap
|
132
|
+
setupldap()
|
133
|
+
end
|
134
|
+
|
135
|
+
hosts = []
|
136
|
+
|
137
|
+
filter = nil
|
138
|
+
if klass == :all
|
139
|
+
filter = "objectclass=puppetclient"
|
140
|
+
else
|
141
|
+
filter = "puppetclass=#{klass}"
|
142
|
+
end
|
143
|
+
@ldap.search(Puppet[:ldapbase], 2, filter, "cn") do |entry|
|
144
|
+
# Skip the default host entry
|
145
|
+
if entry.dn =~ /cn=default,/
|
146
|
+
$stderr.puts "Skipping default host entry"
|
147
|
+
next
|
148
|
+
end
|
149
|
+
|
150
|
+
if fqdn
|
151
|
+
hosts << entry.dn.sub("cn=",'').sub(/ou=hosts,/i, '').gsub(",dc=",".")
|
152
|
+
else
|
153
|
+
hosts << entry.get_values("cn")[0]
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
return hosts
|
158
|
+
end
|
159
|
+
|
160
|
+
def setupldap
|
161
|
+
begin
|
162
|
+
@ldap = Puppet::Parser::Interpreter.ldap()
|
163
|
+
rescue => detail
|
164
|
+
$stderr.puts "Could not connect to LDAP: %s" % detail
|
165
|
+
exit(34)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
$haveusage = true
|
170
|
+
|
171
|
+
begin
|
172
|
+
require 'rdoc/usage'
|
173
|
+
rescue LoadError
|
174
|
+
$haveusage = false
|
175
|
+
end
|
176
|
+
|
177
|
+
flags = [
|
178
|
+
[ "--all", "-a", GetoptLong::NO_ARGUMENT ],
|
179
|
+
[ "--class", "-c", GetoptLong::REQUIRED_ARGUMENT ],
|
180
|
+
[ "--foreground", "-f", GetoptLong::NO_ARGUMENT ],
|
181
|
+
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
|
182
|
+
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
183
|
+
[ "--host", GetoptLong::REQUIRED_ARGUMENT ],
|
184
|
+
[ "--parallel", "-p", GetoptLong::REQUIRED_ARGUMENT ],
|
185
|
+
[ "--no-fqdn", "-n", GetoptLong::NO_ARGUMENT ],
|
186
|
+
[ "--test", GetoptLong::NO_ARGUMENT ],
|
187
|
+
[ "--version", "-V", GetoptLong::NO_ARGUMENT ]
|
188
|
+
]
|
189
|
+
|
190
|
+
# Add all of the config parameters as valid options.
|
191
|
+
Puppet.config.addargs(flags)
|
192
|
+
|
193
|
+
result = GetoptLong.new(*flags)
|
194
|
+
|
195
|
+
options = {
|
196
|
+
:ignoreschedules => false,
|
197
|
+
:foreground => false,
|
198
|
+
:parallel => 1,
|
199
|
+
:debug => false,
|
200
|
+
:test => false,
|
201
|
+
:all => false,
|
202
|
+
:verbose => true,
|
203
|
+
:fqdn => true
|
204
|
+
}
|
205
|
+
|
206
|
+
hosts = []
|
207
|
+
classes = []
|
208
|
+
tags = []
|
209
|
+
|
210
|
+
Puppet::Log.newdestination(:console)
|
211
|
+
|
212
|
+
begin
|
213
|
+
result.each { |opt,arg|
|
214
|
+
case opt
|
215
|
+
when "--version"
|
216
|
+
puts "%s" % Puppet.version
|
217
|
+
exit
|
218
|
+
when "--ignoreschedules"
|
219
|
+
options[:ignoreschedules] = true
|
220
|
+
when "--no-fqdn"
|
221
|
+
options[:fqdn] = false
|
222
|
+
when "--all"
|
223
|
+
options[:all] = true
|
224
|
+
when "--test"
|
225
|
+
options[:test] = true
|
226
|
+
when "--tag"
|
227
|
+
tags << arg
|
228
|
+
when "--class"
|
229
|
+
classes << arg
|
230
|
+
when "--host"
|
231
|
+
hosts << arg
|
232
|
+
when "--help"
|
233
|
+
if $haveusage
|
234
|
+
RDoc::usage && exit
|
235
|
+
else
|
236
|
+
puts "No help available unless you have RDoc::usage installed"
|
237
|
+
exit
|
238
|
+
end
|
239
|
+
when "--parallel"
|
240
|
+
begin
|
241
|
+
options[:parallel] = Integer(arg)
|
242
|
+
rescue
|
243
|
+
$stderr.puts "Could not convert %s to an integer" % arg.inspect
|
244
|
+
exit(23)
|
245
|
+
end
|
246
|
+
when "--foreground"
|
247
|
+
options[:foreground] = true
|
248
|
+
when "--debug"
|
249
|
+
options[:debug] = true
|
250
|
+
else
|
251
|
+
Puppet.config.handlearg(opt, arg)
|
252
|
+
end
|
253
|
+
}
|
254
|
+
rescue GetoptLong::InvalidOption => detail
|
255
|
+
$stderr.puts "Try '#{$0} --help'"
|
256
|
+
#if $haveusage
|
257
|
+
# RDoc::usage(1,'usage')
|
258
|
+
#end
|
259
|
+
exit(1)
|
260
|
+
end
|
261
|
+
|
262
|
+
if options[:debug]
|
263
|
+
Puppet::Log.level = :debug
|
264
|
+
else
|
265
|
+
Puppet::Log.level = :info
|
266
|
+
end
|
267
|
+
|
268
|
+
# Now parse the config
|
269
|
+
config = File.join(Puppet[:confdir], "puppetmasterd.conf")
|
270
|
+
if File.exists? config
|
271
|
+
Puppet.config.parse(config)
|
272
|
+
end
|
273
|
+
|
274
|
+
if Puppet[:ldapnodes]
|
275
|
+
if options[:all]
|
276
|
+
hosts = ldapnodes(:all, options[:fqdn])
|
277
|
+
puts "all: %s" % hosts.join(", ")
|
278
|
+
else
|
279
|
+
classes.each do |klass|
|
280
|
+
list = ldapnodes(klass, options[:fqdn])
|
281
|
+
puts "%s: %s" % [klass, list.join(", ")]
|
282
|
+
|
283
|
+
hosts += list
|
284
|
+
end
|
285
|
+
end
|
286
|
+
elsif ! classes.empty?
|
287
|
+
$stderr.puts "You must be using LDAP to specify host classes"
|
288
|
+
exit(24)
|
289
|
+
end
|
290
|
+
|
291
|
+
if tags.empty?
|
292
|
+
tags = ""
|
293
|
+
else
|
294
|
+
tags = tags.join(",")
|
295
|
+
end
|
296
|
+
|
297
|
+
children = {}
|
298
|
+
|
299
|
+
# If we get a signal, then kill all of our children and get out.
|
300
|
+
[:INT, :TERM].each do |signal|
|
301
|
+
trap(signal) do
|
302
|
+
Puppet.notice "Caught #{signal}; shutting down"
|
303
|
+
children.each do |pid, host|
|
304
|
+
Process.kill("INT", pid)
|
305
|
+
end
|
306
|
+
|
307
|
+
waitall
|
308
|
+
|
309
|
+
exit(1)
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
if options[:test]
|
314
|
+
puts "Skipping execution in test mode"
|
315
|
+
exit(0)
|
316
|
+
end
|
317
|
+
|
318
|
+
todo = hosts.dup
|
319
|
+
|
320
|
+
failures = []
|
321
|
+
|
322
|
+
# Now do the actual work
|
323
|
+
go = true
|
324
|
+
while go
|
325
|
+
# If we don't have enough children in process and we still have hosts left to
|
326
|
+
# do, then do the next host.
|
327
|
+
if children.length < options[:parallel] and ! todo.empty?
|
328
|
+
host = todo.shift
|
329
|
+
pid = fork do
|
330
|
+
# First make sure the client is up
|
331
|
+
out = %x{ping -c 1 #{host}}
|
332
|
+
|
333
|
+
unless $? == 0
|
334
|
+
$stderr.print "Could not contact %s\n" % host
|
335
|
+
next
|
336
|
+
end
|
337
|
+
client = Puppet::Client::Runner.new(
|
338
|
+
:Server => host,
|
339
|
+
:Port => Puppet[:puppetport]
|
340
|
+
)
|
341
|
+
|
342
|
+
print "Triggering %s\n" % host
|
343
|
+
begin
|
344
|
+
client.run(tags, options[:ignoreschedules], options[:foreground])
|
345
|
+
rescue => detail
|
346
|
+
$stderr.print "Host %s failed: %s\n" % [host, detail]
|
347
|
+
exit(2)
|
348
|
+
end
|
349
|
+
end
|
350
|
+
children[pid] = host
|
351
|
+
else
|
352
|
+
# Else, see if we can reap a process.
|
353
|
+
begin
|
354
|
+
pid = Process.wait
|
355
|
+
|
356
|
+
if host = children[pid]
|
357
|
+
# Remove our host from the list of children, so the parallelization
|
358
|
+
# continues working.
|
359
|
+
children.delete(pid)
|
360
|
+
if $?.exitstatus != 0
|
361
|
+
failures << host
|
362
|
+
end
|
363
|
+
print "%s finished with exit code %s\n" % [host, $?.exitstatus]
|
364
|
+
else
|
365
|
+
$stderr.puts "Could not find host for PID %s with status %s" %
|
366
|
+
[pid, $?.exitstatus]
|
367
|
+
end
|
368
|
+
rescue Errno::ECHILD
|
369
|
+
# There are no children left, so just exit unless there are still
|
370
|
+
# children left to do.
|
371
|
+
next unless todo.empty?
|
372
|
+
|
373
|
+
if failures.empty?
|
374
|
+
puts "Finished"
|
375
|
+
exit(0)
|
376
|
+
else
|
377
|
+
puts "Failed: %s" % failures.join(", ")
|
378
|
+
exit(3)
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
|
385
|
+
# $Id: puppetrun 1338 2006-06-29 19:29:05Z luke $
|
data/conf/redhat/client.init
CHANGED
data/conf/redhat/fileserver.conf
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- puppet-0.18.0/conf/redhat/fileserver.conf.orig 2006-06-20 12:13:49.000000000 -0700
|
2
|
+
+++ puppet-0.18.0/conf/redhat/fileserver.conf 2006-06-20 12:14:03.000000000 -0700
|
3
|
+
@@ -6,7 +6,7 @@
|
4
|
+
# for allow/deny does not matter, allow always takes precedence
|
5
|
+
# over deny
|
6
|
+
[files]
|
7
|
+
- path /var/puppet/files
|
8
|
+
+ path /var/lib/puppet/files
|
9
|
+
# allow *.example.com
|
10
|
+
# deny *.evil.example.com
|
11
|
+
# allow 192.168.0.0/24
|
12
|
+
--- puppet-0.18.0/conf/redhat/puppetd.conf.orig 2006-06-20 12:12:01.000000000 -0700
|
13
|
+
+++ puppet-0.18.0/conf/redhat/puppetd.conf 2006-06-20 12:14:37.000000000 -0700
|
14
|
+
@@ -1,5 +1,33 @@
|
15
|
+
+[puppet]
|
16
|
+
+ # Where Puppet stores dynamic and growing data.
|
17
|
+
+ # The default value is '/var/puppet'.
|
18
|
+
+ vardir = /var/lib/puppet
|
19
|
+
+
|
20
|
+
+ # The Puppet log directory.
|
21
|
+
+ # The default value is '$vardir/log'.
|
22
|
+
+ logdir = /var/log/puppet
|
23
|
+
+
|
24
|
+
+ # Where Puppet PID files are kept.
|
25
|
+
+ # The default value is '$vardir/run'.
|
26
|
+
+ rundir = /var/run/puppet
|
27
|
+
+
|
28
|
+
+ # Where lock files are kept.
|
29
|
+
+ # The default value is '$vardir/locks'.
|
30
|
+
+ lockdir = /var/lock
|
31
|
+
+
|
32
|
+
+ # Where SSL certificates are kept.
|
33
|
+
+ # The default value is '$confdir/ssl'.
|
34
|
+
+ ssldir = $vardir/ssl
|
35
|
+
+
|
36
|
+
[puppetd]
|
37
|
+
-# Make sure all log messages are sent to the right directory
|
38
|
+
-# This directory must be writable by the puppet user
|
39
|
+
-logdir=/var/log/puppet
|
40
|
+
-rundir=/var/run
|
41
|
+
+ # The file in which puppetd stores a list of the classes
|
42
|
+
+ # associated with the retrieved configuratiion. Can be loaded in
|
43
|
+
+ # the separate ``puppet`` executable using the ``--loadclasses``
|
44
|
+
+ # option.
|
45
|
+
+ # The default value is '$confdir/classes.txt'.
|
46
|
+
+ classfile = $vardir/classes.txt
|
47
|
+
+
|
48
|
+
+ # Where puppetd caches the local configuration. An
|
49
|
+
+ # extension indicating the cache format is added automatically.
|
50
|
+
+ # The default value is '$confdir/localconfig'.
|
51
|
+
+ localconfig = $vardir/localconfig
|