puppet 0.9.2
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 +0 -0
- data/COPYING +340 -0
- data/LICENSE +17 -0
- data/README +24 -0
- data/Rakefile +294 -0
- data/TODO +4 -0
- data/bin/cf2puppet +186 -0
- data/bin/puppet +176 -0
- data/bin/puppetca +213 -0
- data/bin/puppetd +246 -0
- data/bin/puppetdoc +184 -0
- data/bin/puppetmasterd +258 -0
- data/examples/code/allatonce +13 -0
- data/examples/code/assignments +11 -0
- data/examples/code/classing +35 -0
- data/examples/code/components +73 -0
- data/examples/code/execs +16 -0
- data/examples/code/failers/badclassnoparam +10 -0
- data/examples/code/failers/badclassparam +10 -0
- data/examples/code/failers/badcompnoparam +9 -0
- data/examples/code/failers/badcompparam +9 -0
- data/examples/code/failers/badtypeparam +3 -0
- data/examples/code/file.bl +11 -0
- data/examples/code/filedefaults +10 -0
- data/examples/code/fileparsing +116 -0
- data/examples/code/filerecursion +15 -0
- data/examples/code/functions +3 -0
- data/examples/code/groups +7 -0
- data/examples/code/head +30 -0
- data/examples/code/importing +8 -0
- data/examples/code/nodes +20 -0
- data/examples/code/one +8 -0
- data/examples/code/relationships +34 -0
- data/examples/code/selectors +28 -0
- data/examples/code/simpletests +11 -0
- data/examples/code/snippets/argumentdefaults +14 -0
- data/examples/code/snippets/casestatement +39 -0
- data/examples/code/snippets/classheirarchy.pp +15 -0
- data/examples/code/snippets/classincludes.pp +17 -0
- data/examples/code/snippets/classpathtest +11 -0
- data/examples/code/snippets/dirchmod +19 -0
- data/examples/code/snippets/failmissingexecpath.pp +13 -0
- data/examples/code/snippets/falsevalues.pp +3 -0
- data/examples/code/snippets/filecreate +11 -0
- data/examples/code/snippets/implicititeration +15 -0
- data/examples/code/snippets/multipleinstances +7 -0
- data/examples/code/snippets/namevartest +9 -0
- data/examples/code/snippets/scopetest +13 -0
- data/examples/code/snippets/selectorvalues.pp +22 -0
- data/examples/code/snippets/simpledefaults +5 -0
- data/examples/code/snippets/simpleselector +38 -0
- data/examples/code/svncommit +13 -0
- data/examples/root/bin/sleeper +69 -0
- data/examples/root/etc/configfile +0 -0
- data/examples/root/etc/debian-passwd +29 -0
- data/examples/root/etc/debian-syslog.conf +71 -0
- data/examples/root/etc/init.d/sleeper +65 -0
- data/examples/root/etc/otherfile +0 -0
- data/examples/root/etc/puppet/fileserver.conf +3 -0
- data/examples/root/etc/puppet/puppetmasterd.conf +10 -0
- data/ext/module:puppet +195 -0
- data/install.rb +270 -0
- data/lib/puppet.rb +249 -0
- data/lib/puppet/base64.rb +19 -0
- data/lib/puppet/client.rb +519 -0
- data/lib/puppet/config.rb +49 -0
- data/lib/puppet/daemon.rb +208 -0
- data/lib/puppet/element.rb +71 -0
- data/lib/puppet/event.rb +259 -0
- data/lib/puppet/log.rb +321 -0
- data/lib/puppet/metric.rb +250 -0
- data/lib/puppet/parsedfile.rb +38 -0
- data/lib/puppet/parser/ast.rb +1560 -0
- data/lib/puppet/parser/interpreter.rb +150 -0
- data/lib/puppet/parser/lexer.rb +226 -0
- data/lib/puppet/parser/parser.rb +1354 -0
- data/lib/puppet/parser/scope.rb +755 -0
- data/lib/puppet/server.rb +170 -0
- data/lib/puppet/server/authstore.rb +227 -0
- data/lib/puppet/server/ca.rb +140 -0
- data/lib/puppet/server/filebucket.rb +147 -0
- data/lib/puppet/server/fileserver.rb +477 -0
- data/lib/puppet/server/logger.rb +43 -0
- data/lib/puppet/server/master.rb +103 -0
- data/lib/puppet/server/servlet.rb +247 -0
- data/lib/puppet/sslcertificates.rb +737 -0
- data/lib/puppet/statechange.rb +150 -0
- data/lib/puppet/storage.rb +95 -0
- data/lib/puppet/transaction.rb +179 -0
- data/lib/puppet/transportable.rb +151 -0
- data/lib/puppet/type.rb +1354 -0
- data/lib/puppet/type/component.rb +141 -0
- data/lib/puppet/type/cron.rb +543 -0
- data/lib/puppet/type/exec.rb +316 -0
- data/lib/puppet/type/group.rb +152 -0
- data/lib/puppet/type/nameservice.rb +3 -0
- data/lib/puppet/type/nameservice/netinfo.rb +173 -0
- data/lib/puppet/type/nameservice/objectadd.rb +146 -0
- data/lib/puppet/type/nameservice/posix.rb +200 -0
- data/lib/puppet/type/package.rb +420 -0
- data/lib/puppet/type/package/apt.rb +70 -0
- data/lib/puppet/type/package/dpkg.rb +108 -0
- data/lib/puppet/type/package/rpm.rb +81 -0
- data/lib/puppet/type/package/sun.rb +117 -0
- data/lib/puppet/type/package/yum.rb +58 -0
- data/lib/puppet/type/pfile.rb +569 -0
- data/lib/puppet/type/pfile/checksum.rb +219 -0
- data/lib/puppet/type/pfile/create.rb +108 -0
- data/lib/puppet/type/pfile/group.rb +129 -0
- data/lib/puppet/type/pfile/mode.rb +131 -0
- data/lib/puppet/type/pfile/source.rb +264 -0
- data/lib/puppet/type/pfile/type.rb +31 -0
- data/lib/puppet/type/pfile/uid.rb +166 -0
- data/lib/puppet/type/pfilebucket.rb +80 -0
- data/lib/puppet/type/pprocess.rb +97 -0
- data/lib/puppet/type/service.rb +347 -0
- data/lib/puppet/type/service/base.rb +17 -0
- data/lib/puppet/type/service/debian.rb +50 -0
- data/lib/puppet/type/service/init.rb +145 -0
- data/lib/puppet/type/service/smf.rb +29 -0
- data/lib/puppet/type/state.rb +182 -0
- data/lib/puppet/type/symlink.rb +183 -0
- data/lib/puppet/type/tidy.rb +183 -0
- data/lib/puppet/type/typegen.rb +149 -0
- data/lib/puppet/type/typegen/filerecord.rb +243 -0
- data/lib/puppet/type/typegen/filetype.rb +316 -0
- data/lib/puppet/type/user.rb +290 -0
- data/lib/puppet/util.rb +138 -0
- data/test/certmgr/certmgr.rb +265 -0
- data/test/client/client.rb +203 -0
- data/test/executables/puppetbin.rb +53 -0
- data/test/executables/puppetca.rb +79 -0
- data/test/executables/puppetd.rb +71 -0
- data/test/executables/puppetmasterd.rb +153 -0
- data/test/executables/puppetmodule.rb +60 -0
- data/test/language/ast.rb +412 -0
- data/test/language/interpreter.rb +71 -0
- data/test/language/scope.rb +412 -0
- data/test/language/snippets.rb +445 -0
- data/test/other/events.rb +111 -0
- data/test/other/log.rb +195 -0
- data/test/other/metrics.rb +92 -0
- data/test/other/overrides.rb +115 -0
- data/test/other/parsedfile.rb +31 -0
- data/test/other/relationships.rb +113 -0
- data/test/other/state.rb +106 -0
- data/test/other/storage.rb +39 -0
- data/test/other/transactions.rb +235 -0
- data/test/parser/lexer.rb +120 -0
- data/test/parser/parser.rb +180 -0
- data/test/puppet/conffiles.rb +104 -0
- data/test/puppet/defaults.rb +100 -0
- data/test/puppet/error.rb +23 -0
- data/test/puppet/utiltest.rb +120 -0
- data/test/puppettest.rb +774 -0
- data/test/server/authstore.rb +209 -0
- data/test/server/bucket.rb +227 -0
- data/test/server/ca.rb +201 -0
- data/test/server/fileserver.rb +710 -0
- data/test/server/logger.rb +175 -0
- data/test/server/master.rb +150 -0
- data/test/server/server.rb +130 -0
- data/test/tagging/tagging.rb +80 -0
- data/test/test +51 -0
- data/test/types/basic.rb +119 -0
- data/test/types/component.rb +272 -0
- data/test/types/cron.rb +261 -0
- data/test/types/exec.rb +273 -0
- data/test/types/file.rb +616 -0
- data/test/types/filebucket.rb +167 -0
- data/test/types/fileignoresource.rb +287 -0
- data/test/types/filesources.rb +587 -0
- data/test/types/filetype.rb +162 -0
- data/test/types/group.rb +271 -0
- data/test/types/package.rb +205 -0
- data/test/types/query.rb +101 -0
- data/test/types/service.rb +100 -0
- data/test/types/symlink.rb +93 -0
- data/test/types/tidy.rb +124 -0
- data/test/types/type.rb +135 -0
- data/test/types/user.rb +371 -0
- metadata +243 -0
data/bin/puppetd
ADDED
@@ -0,0 +1,246 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# == Synopsis
|
3
|
+
#
|
4
|
+
# Retrieve the client configuration from the central puppet server and apply
|
5
|
+
# it to the local host.
|
6
|
+
#
|
7
|
+
# Currently must be run out periodically, using cron or something similar.
|
8
|
+
#
|
9
|
+
# = Usage
|
10
|
+
#
|
11
|
+
# puppetd [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
|
12
|
+
# [--ssldir <cert directory>] [-l|--logdest <syslog|<file>|console>]
|
13
|
+
# [--fqdn <host name>] [-p|--port <port>] [-s|--server <server>]
|
14
|
+
# [-w|--waitforcert <seconds>] [-c|--confdir <configuration directory>]
|
15
|
+
# [--vardir <var directory>] [--centrallogging]
|
16
|
+
#
|
17
|
+
# = Description
|
18
|
+
#
|
19
|
+
# This is the main puppet client. Its job is to retrieve the local machine's
|
20
|
+
# configuration from a remote server and apply it. In order to successfully
|
21
|
+
# communicate with the remote server, the client must have a certificate signed
|
22
|
+
# by a certificate authority that the server trusts; the recommended method
|
23
|
+
# for this, at the moment, is to run a certificate authority as part of the
|
24
|
+
# puppet server (which is the default). The client will connect and request
|
25
|
+
# a signed certificate, and will continue connecting until it receives one.
|
26
|
+
#
|
27
|
+
# Once the client has a signed certificate, it will retrieve its configuration
|
28
|
+
# and apply it.
|
29
|
+
#
|
30
|
+
# = Options
|
31
|
+
#
|
32
|
+
# centrallogging::
|
33
|
+
# Send all produced logs to the central puppetmasterd system. This currently
|
34
|
+
# results in a significant slowdown, so it is not recommended.
|
35
|
+
#
|
36
|
+
# confdir::
|
37
|
+
# The configuration root directory, where +puppetmasterd+ defaults to looking
|
38
|
+
# for all of its configuration files. Defaults to +/etc/puppet+.
|
39
|
+
#
|
40
|
+
# debug::
|
41
|
+
# Enable full debugging.
|
42
|
+
#
|
43
|
+
# fqdn::
|
44
|
+
# Set the fully-qualified domain name of the client. This is only used for
|
45
|
+
# certificate purposes, but can be used to override the discovered hostname.
|
46
|
+
# If you need to use this flag, it is generally an indication of a setup problem.
|
47
|
+
#
|
48
|
+
# help::
|
49
|
+
# Print this help message
|
50
|
+
#
|
51
|
+
# logdest::
|
52
|
+
# Where to send messages. Choose between syslog, the console, and a log file.
|
53
|
+
# Defaults to sending messages to /var/puppet/log/puppet.log, or the console
|
54
|
+
# if debugging or verbosity is enabled.
|
55
|
+
#
|
56
|
+
# port::
|
57
|
+
# The port to which to connect on the remote server. Currently defaults to 8139.
|
58
|
+
#
|
59
|
+
# server::
|
60
|
+
# The remote server from whom to receive the local configuration. Currently
|
61
|
+
# must also be the certificate authority. Currently defaults to 'puppet'.
|
62
|
+
#
|
63
|
+
# ssldir::
|
64
|
+
# Where to store and find certificates. Defaults to /etc/puppet/ssl.
|
65
|
+
#
|
66
|
+
# vardir::
|
67
|
+
# The variable-size directory, used for storing state. Defaults to
|
68
|
+
# /var/puppet.
|
69
|
+
#
|
70
|
+
# verbose::
|
71
|
+
# Turn on verbose reporting.
|
72
|
+
#
|
73
|
+
# version::
|
74
|
+
# Print the puppet version number and exit.
|
75
|
+
#
|
76
|
+
# waitforcert::
|
77
|
+
# Have the process wait around, continuously retrying for the certificate
|
78
|
+
# each <argument> seconds.
|
79
|
+
#
|
80
|
+
# = Example
|
81
|
+
#
|
82
|
+
# puppet -s puppet.domain.com
|
83
|
+
#
|
84
|
+
# = Author
|
85
|
+
#
|
86
|
+
# Luke Kanies
|
87
|
+
#
|
88
|
+
# = Copyright
|
89
|
+
#
|
90
|
+
# Copyright (c) 2005 Reductive Labs, LLC
|
91
|
+
# Licensed under the GNU Public License
|
92
|
+
|
93
|
+
|
94
|
+
require 'puppet'
|
95
|
+
require 'puppet/server'
|
96
|
+
require 'puppet/client'
|
97
|
+
require 'getoptlong'
|
98
|
+
|
99
|
+
$haveusage = true
|
100
|
+
begin
|
101
|
+
require 'rdoc/usage'
|
102
|
+
rescue LoadError
|
103
|
+
$haveusage = false
|
104
|
+
end
|
105
|
+
|
106
|
+
result = GetoptLong.new(
|
107
|
+
[ "--centrallogging", GetoptLong::NO_ARGUMENT ],
|
108
|
+
[ "--confdir", "-c", GetoptLong::REQUIRED_ARGUMENT ],
|
109
|
+
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
|
110
|
+
[ "--fqdn", "-f", GetoptLong::REQUIRED_ARGUMENT ],
|
111
|
+
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
112
|
+
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
|
113
|
+
[ "--noop", "-n", GetoptLong::NO_ARGUMENT ],
|
114
|
+
[ "--port", "-p", GetoptLong::REQUIRED_ARGUMENT ],
|
115
|
+
[ "--server", "-s", GetoptLong::REQUIRED_ARGUMENT ],
|
116
|
+
[ "--ssldir", GetoptLong::REQUIRED_ARGUMENT ],
|
117
|
+
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
|
118
|
+
[ "--version", "-V", GetoptLong::NO_ARGUMENT ],
|
119
|
+
[ "--vardir", GetoptLong::REQUIRED_ARGUMENT ],
|
120
|
+
[ "--waitforcert", "-w", GetoptLong::REQUIRED_ARGUMENT ]
|
121
|
+
)
|
122
|
+
|
123
|
+
server = "puppet"
|
124
|
+
fqdn = nil
|
125
|
+
args = {}
|
126
|
+
|
127
|
+
waitforcert = false
|
128
|
+
|
129
|
+
centrallogs = false
|
130
|
+
begin
|
131
|
+
result.each { |opt,arg|
|
132
|
+
case opt
|
133
|
+
when "--centrallogging"
|
134
|
+
centrallogs = true
|
135
|
+
when "--confdir"
|
136
|
+
Puppet[:puppetconf] = arg
|
137
|
+
when "--help"
|
138
|
+
if $haveusage
|
139
|
+
RDoc::usage && exit
|
140
|
+
else
|
141
|
+
puts "No help available unless you have RDoc::usage installed"
|
142
|
+
exit
|
143
|
+
end
|
144
|
+
when "--version"
|
145
|
+
puts "%s" % Puppet.version
|
146
|
+
exit
|
147
|
+
when "--verbose"
|
148
|
+
Puppet[:loglevel] = :info
|
149
|
+
Puppet[:logdest] = :console
|
150
|
+
when "--debug"
|
151
|
+
Puppet[:loglevel] = :debug
|
152
|
+
Puppet[:logdest] = :console
|
153
|
+
when "--noop"
|
154
|
+
Puppet[:noop] = true
|
155
|
+
when "--ssldir"
|
156
|
+
Puppet[:ssldir] = arg
|
157
|
+
when "--fqdn"
|
158
|
+
fqdn = arg
|
159
|
+
when "--server"
|
160
|
+
server = arg
|
161
|
+
when "--port"
|
162
|
+
args[:Port] = arg
|
163
|
+
when "--logdest"
|
164
|
+
begin
|
165
|
+
Puppet[:logdest] = arg
|
166
|
+
rescue => detail
|
167
|
+
$stderr.puts detail.to_s
|
168
|
+
end
|
169
|
+
when "--vardir"
|
170
|
+
Puppet[:puppetvar] = arg
|
171
|
+
when "--waitforcert"
|
172
|
+
waitforcert = arg
|
173
|
+
end
|
174
|
+
}
|
175
|
+
rescue GetoptLong::InvalidOption => detail
|
176
|
+
$stderr.puts "Try '#{$0} --help'"
|
177
|
+
#$stderr.puts detail
|
178
|
+
# FIXME RDoc::usage doesn't seem to work
|
179
|
+
#if $haveusage
|
180
|
+
# RDoc::usage(1,'usage')
|
181
|
+
#end
|
182
|
+
exit(1)
|
183
|
+
end
|
184
|
+
|
185
|
+
bg = false
|
186
|
+
|
187
|
+
if Puppet[:loglevel] == :debug or Puppet[:loglevel] == :info
|
188
|
+
args[:Daemonize] = false
|
189
|
+
else
|
190
|
+
args[:Daemonize] = true
|
191
|
+
end
|
192
|
+
|
193
|
+
args[:Server] = server
|
194
|
+
if fqdn
|
195
|
+
args[:FQDN] = fqdn
|
196
|
+
end
|
197
|
+
|
198
|
+
if centrallogs
|
199
|
+
logdest = args[:Server]
|
200
|
+
|
201
|
+
if args.include?(:Port)
|
202
|
+
logdest += ":" + args[:Port]
|
203
|
+
end
|
204
|
+
Puppet[:logdest] = logdest
|
205
|
+
end
|
206
|
+
|
207
|
+
|
208
|
+
client = Puppet::Client::MasterClient.new(args)
|
209
|
+
|
210
|
+
|
211
|
+
unless client.readcert
|
212
|
+
if waitforcert
|
213
|
+
begin
|
214
|
+
while ! client.requestcert do
|
215
|
+
Puppet.notice "Did not receive certificate"
|
216
|
+
sleep waitforcert
|
217
|
+
end
|
218
|
+
rescue => detail
|
219
|
+
Puppet.err "Could not request certificate: %s" % detail.to_s
|
220
|
+
exit(23)
|
221
|
+
end
|
222
|
+
else
|
223
|
+
unless client.requestcert
|
224
|
+
Puppet.notice "No certificates; exiting"
|
225
|
+
exit(1)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
if bg
|
231
|
+
client.daemonize
|
232
|
+
end
|
233
|
+
|
234
|
+
# now set up the network client with the certs, now that we have them
|
235
|
+
client.setcerts
|
236
|
+
|
237
|
+
# and then retrieve and apply our configuration
|
238
|
+
begin
|
239
|
+
client.getconfig
|
240
|
+
client.apply
|
241
|
+
rescue => detail
|
242
|
+
Puppet.err detail.to_s
|
243
|
+
exit(13)
|
244
|
+
end
|
245
|
+
|
246
|
+
# $Id: puppetd 733 2005-10-28 21:28:59Z luke $
|
data/bin/puppetdoc
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
#
|
4
|
+
# = Synopsis
|
5
|
+
#
|
6
|
+
# Generate a reference for all Puppet types. Largely meant for internal Reductive
|
7
|
+
# Labs use.
|
8
|
+
#
|
9
|
+
# = Usage
|
10
|
+
#
|
11
|
+
# puppetdoc [-h|--help]
|
12
|
+
#
|
13
|
+
# = Description
|
14
|
+
#
|
15
|
+
# This command generates a restructured-text document describing all installed
|
16
|
+
# Puppet types. It is largely meant for internal use and is used to generate
|
17
|
+
# the reference document available on the Reductive Labs web site.
|
18
|
+
#
|
19
|
+
# = Options
|
20
|
+
#
|
21
|
+
# help::
|
22
|
+
# Print this help message
|
23
|
+
#
|
24
|
+
# = Example
|
25
|
+
#
|
26
|
+
# $ puppetdoc > /tmp/reference.rst
|
27
|
+
#
|
28
|
+
# = Author
|
29
|
+
#
|
30
|
+
# Luke Kanies
|
31
|
+
#
|
32
|
+
# = Copyright
|
33
|
+
#
|
34
|
+
# Copyright (c) 2005 Reductive Labs, LLC
|
35
|
+
# Licensed under the GNU Public License
|
36
|
+
|
37
|
+
require 'puppet'
|
38
|
+
require 'getoptlong'
|
39
|
+
|
40
|
+
$haveusage = true
|
41
|
+
|
42
|
+
begin
|
43
|
+
require 'rdoc/usage'
|
44
|
+
rescue LoadError
|
45
|
+
$haveusage = false
|
46
|
+
end
|
47
|
+
|
48
|
+
def tab(num)
|
49
|
+
return $tab * num
|
50
|
+
end
|
51
|
+
|
52
|
+
result = GetoptLong.new(
|
53
|
+
[ "--help", "-h", GetoptLong::NO_ARGUMENT ]
|
54
|
+
)
|
55
|
+
|
56
|
+
debug = false
|
57
|
+
|
58
|
+
$tab = " "
|
59
|
+
|
60
|
+
begin
|
61
|
+
result.each { |opt,arg|
|
62
|
+
case opt
|
63
|
+
when "--help"
|
64
|
+
if $haveusage
|
65
|
+
RDoc::usage && exit
|
66
|
+
else
|
67
|
+
puts "No help available unless you have RDoc::usage installed"
|
68
|
+
exit
|
69
|
+
end
|
70
|
+
end
|
71
|
+
}
|
72
|
+
rescue GetoptLong::InvalidOption => detail
|
73
|
+
$stderr.puts "Try '#{$0} --help'"
|
74
|
+
#if $haveusage
|
75
|
+
# RDoc::usage_no_exit('usage')
|
76
|
+
#end
|
77
|
+
exit(1)
|
78
|
+
end
|
79
|
+
|
80
|
+
puts %{
|
81
|
+
==============
|
82
|
+
Type Reference
|
83
|
+
==============
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
types = {}
|
88
|
+
Puppet::Type.eachtype { |type|
|
89
|
+
types[type.name] = type
|
90
|
+
}
|
91
|
+
puts %{
|
92
|
+
---------------
|
93
|
+
Meta-Parameters
|
94
|
+
---------------
|
95
|
+
|
96
|
+
}
|
97
|
+
params = []
|
98
|
+
Puppet::Type.eachmetaparam { |param|
|
99
|
+
params << param
|
100
|
+
}
|
101
|
+
|
102
|
+
params.sort { |a,b|
|
103
|
+
a.to_s <=> b.to_s
|
104
|
+
}.each { |param|
|
105
|
+
puts "- **" + param.to_s + "**"
|
106
|
+
puts tab(1) + Puppet::Type.metaparamdoc(param).gsub(/\n\s*/,' ')
|
107
|
+
}
|
108
|
+
|
109
|
+
puts %{
|
110
|
+
-----
|
111
|
+
Types
|
112
|
+
-----
|
113
|
+
|
114
|
+
- *namevar* is the parameter used to uniquely identify a type instance.
|
115
|
+
This is the parameter that gets assigned when a string is provided before
|
116
|
+
the colon in a type declaration.
|
117
|
+
- *parameters* determine the specific configuration of the instance.
|
118
|
+
|
119
|
+
|
120
|
+
}
|
121
|
+
|
122
|
+
types.sort { |a,b|
|
123
|
+
a.to_s <=> b.to_s
|
124
|
+
}.each { |name,type|
|
125
|
+
next if name == :puppet
|
126
|
+
next if name == :component
|
127
|
+
|
128
|
+
puts "
|
129
|
+
|
130
|
+
----------------
|
131
|
+
|
132
|
+
"
|
133
|
+
|
134
|
+
puts "
|
135
|
+
%s
|
136
|
+
%s" % [name, "=" * (name.to_s.length + 4)]
|
137
|
+
#String.new('n%s\n') % name.to_s
|
138
|
+
#puts "**" + type.doc.gsub(/\n\s*/, ' ') + "**\n\n"
|
139
|
+
puts type.doc.gsub(/\n\s*/, ' ') + "\n\n"
|
140
|
+
type.buildstatehash
|
141
|
+
#puts tab(1) + "* namevar: %s" % type.namevar
|
142
|
+
docs = {}
|
143
|
+
#puts "%s States\n'''''''''''''''''''''''''''''''" % name.to_s.capitalize
|
144
|
+
type.validstates.sort { |a,b|
|
145
|
+
a.to_s <=> b.to_s
|
146
|
+
}.reject { |sname|
|
147
|
+
state = type.statebyname(sname)
|
148
|
+
state.nodoc
|
149
|
+
}.each { |sname|
|
150
|
+
state = type.statebyname(sname)
|
151
|
+
docs[sname] = state.doc.gsub(/\n\s*/,' ')
|
152
|
+
#puts "- **%s**" % sname
|
153
|
+
#puts tab(1) + state.doc.gsub(/\n\s*/,' ')
|
154
|
+
}
|
155
|
+
|
156
|
+
puts "\n%s Parameters\n''''''''''''''''''''''''''''''" % name.to_s.capitalize
|
157
|
+
type.parameters.sort { |a,b|
|
158
|
+
a.to_s <=> b.to_s
|
159
|
+
}.each { |name,param|
|
160
|
+
docs[name] = type.paramdoc(name).gsub(/\n\s*/,' ')
|
161
|
+
}
|
162
|
+
|
163
|
+
docs.sort { |a, b|
|
164
|
+
a[0].to_s <=> b[0].to_s
|
165
|
+
}.each { |name, doc|
|
166
|
+
print "- **%s**" % name
|
167
|
+
if type.namevar == name and name != :name
|
168
|
+
puts " (*namevar*)"
|
169
|
+
else
|
170
|
+
puts ""
|
171
|
+
end
|
172
|
+
puts tab(1) + doc
|
173
|
+
}
|
174
|
+
puts "\n"
|
175
|
+
}
|
176
|
+
|
177
|
+
puts "
|
178
|
+
|
179
|
+
----------------
|
180
|
+
|
181
|
+
"
|
182
|
+
|
183
|
+
puts "\n*This page autogenerated on %s*" % Time.now
|
184
|
+
# $Id: puppetdoc 742 2005-11-16 17:12:11Z luke $
|
data/bin/puppetmasterd
ADDED
@@ -0,0 +1,258 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
#
|
4
|
+
# = Synopsis
|
5
|
+
#
|
6
|
+
# The central puppet server. Can also function as a certificate authority.
|
7
|
+
#
|
8
|
+
# = Usage
|
9
|
+
#
|
10
|
+
# puppetmasterd [-h|--help] [-d|--debug] [-v|--verbose] [-V|--version]
|
11
|
+
# [-l|--logdest <syslog|console|<file>>] [--httplog <file>]
|
12
|
+
# [-m|--manifest <site manifest>] [--noca] [-p|--port <port>]
|
13
|
+
# [--parseonly] [-s|--ssldir <cert directory>]
|
14
|
+
# [-c|--confdir <configuration directory>] [--vardir <var dir>]
|
15
|
+
#
|
16
|
+
# = Description
|
17
|
+
#
|
18
|
+
# This is the standalone puppet execution script; use it to execute
|
19
|
+
# individual scripts that you write. If you need to execute site-wide
|
20
|
+
# scripts, use +puppetd+ and +puppetmasterd+.
|
21
|
+
#
|
22
|
+
# = Options
|
23
|
+
#
|
24
|
+
# autosign::
|
25
|
+
# Enable autosign (which presents a potential security problem). If enabled,
|
26
|
+
# refers to the autosign configuration file at /etc/puppet/autosign.conf to
|
27
|
+
# determine which hosts should have their certificates signed.
|
28
|
+
#
|
29
|
+
# confdir::
|
30
|
+
# The configuration root directory, where +puppetmasterd+ defaults to looking
|
31
|
+
# for all of its configuration files. Defaults to +/etc/puppet+.
|
32
|
+
#
|
33
|
+
# debug::
|
34
|
+
# Enable full debugging. Causes the daemon not to go into the background.
|
35
|
+
#
|
36
|
+
# fsconfig::
|
37
|
+
# Where to find the fileserver configuration file. Defaults to
|
38
|
+
# /etc/puppet/fileserver.conf. If the fileserver config file exists,
|
39
|
+
# the puppetmasterd daemon will automatically also become a fileserver.
|
40
|
+
#
|
41
|
+
# help::
|
42
|
+
# Print this help message.
|
43
|
+
#
|
44
|
+
# httplog::
|
45
|
+
# Where to send http logs (which are currently separate from Puppet logs).
|
46
|
+
# Defaults to /var/puppet/log/http.log.
|
47
|
+
#
|
48
|
+
# logdest::
|
49
|
+
# Where to send messages. Choose between syslog, the console, and a log file.
|
50
|
+
# Defaults to sending messages to /var/puppet/log/puppet.log, or the console
|
51
|
+
# if debugging or verbosity is enabled.
|
52
|
+
#
|
53
|
+
# manifest::
|
54
|
+
# The central site manifest to use for providing clients with their individual
|
55
|
+
# configurations. Defaults to /etc/puppet/manifests/site.pp.
|
56
|
+
#
|
57
|
+
# noca::
|
58
|
+
# Do not function as a certificate authority.
|
59
|
+
#
|
60
|
+
# nonodes::
|
61
|
+
# Do not use individual node designations; each node will receive the result
|
62
|
+
# of evaluating the entire configuration.
|
63
|
+
#
|
64
|
+
# parseonly::
|
65
|
+
# Just parse the central manifest to verify it is syntactically correct.
|
66
|
+
#
|
67
|
+
# port::
|
68
|
+
# The port on which to listen. Defaults to 8139.
|
69
|
+
#
|
70
|
+
# ssldir::
|
71
|
+
# The directory in which to store certificates. Defaults to /etc/puppet/ssl.
|
72
|
+
#
|
73
|
+
# vardir::
|
74
|
+
# The variable-size directory, used for storing state. Defaults to
|
75
|
+
# /var/puppet.
|
76
|
+
#
|
77
|
+
# verbose::
|
78
|
+
# Enable verbosity. Causes the daemon not to go into the background.
|
79
|
+
#
|
80
|
+
# version::
|
81
|
+
# Print the puppet version number and exit.
|
82
|
+
#
|
83
|
+
# = Example
|
84
|
+
#
|
85
|
+
# puppetmasterd
|
86
|
+
#
|
87
|
+
# = Author
|
88
|
+
#
|
89
|
+
# Luke Kanies
|
90
|
+
#
|
91
|
+
# = Copyright
|
92
|
+
#
|
93
|
+
# Copyright (c) 2005 Reductive Labs, LLC
|
94
|
+
# Licensed under the GNU Public License
|
95
|
+
|
96
|
+
require 'getoptlong'
|
97
|
+
require 'puppet'
|
98
|
+
require 'puppet/server'
|
99
|
+
|
100
|
+
result = GetoptLong.new(
|
101
|
+
[ "--autosign", "-a", GetoptLong::NO_ARGUMENT ],
|
102
|
+
[ "--confdir", "-c", GetoptLong::REQUIRED_ARGUMENT ],
|
103
|
+
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
|
104
|
+
[ "--fsconfig", "-f", GetoptLong::REQUIRED_ARGUMENT ],
|
105
|
+
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
|
106
|
+
[ "--httplog", GetoptLong::NO_ARGUMENT ],
|
107
|
+
[ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ],
|
108
|
+
[ "--manifest", "-m", GetoptLong::REQUIRED_ARGUMENT ],
|
109
|
+
[ "--noca", GetoptLong::NO_ARGUMENT ],
|
110
|
+
[ "--nonodes", GetoptLong::NO_ARGUMENT ],
|
111
|
+
[ "--parseonly", GetoptLong::NO_ARGUMENT ],
|
112
|
+
[ "--port", "-p", GetoptLong::REQUIRED_ARGUMENT ],
|
113
|
+
[ "--ssldir", "-s", GetoptLong::REQUIRED_ARGUMENT ],
|
114
|
+
[ "--vardir", GetoptLong::REQUIRED_ARGUMENT ],
|
115
|
+
[ "--verbose", "-v", GetoptLong::NO_ARGUMENT ],
|
116
|
+
[ "--version", "-V", GetoptLong::NO_ARGUMENT ]
|
117
|
+
)
|
118
|
+
|
119
|
+
$haveusage = true
|
120
|
+
|
121
|
+
begin
|
122
|
+
require 'rdoc/usage'
|
123
|
+
rescue LoadError
|
124
|
+
$haveusage = false
|
125
|
+
end
|
126
|
+
|
127
|
+
haveca = true
|
128
|
+
master = {}
|
129
|
+
ca = {}
|
130
|
+
fs = {}
|
131
|
+
args = {}
|
132
|
+
|
133
|
+
parseonly = false
|
134
|
+
|
135
|
+
begin
|
136
|
+
result.each { |opt,arg|
|
137
|
+
case opt
|
138
|
+
when "--autosign"
|
139
|
+
ca[:autosign] = Puppet[:autosign]
|
140
|
+
when "--confdir"
|
141
|
+
Puppet[:puppetconf] = arg
|
142
|
+
when "--debug"
|
143
|
+
Puppet[:debug] = true
|
144
|
+
Puppet[:logdest] = :console
|
145
|
+
when "--fsconfig"
|
146
|
+
unless FileTest.exists?(arg)
|
147
|
+
$stderr.puts "File server configuration file %s does not exist" %
|
148
|
+
arg
|
149
|
+
exit(23)
|
150
|
+
end
|
151
|
+
fs[:Config] = arg
|
152
|
+
when "--help"
|
153
|
+
if $haveusage
|
154
|
+
RDoc::usage && exit
|
155
|
+
else
|
156
|
+
puts "No help available unless you have RDoc::usage installed"
|
157
|
+
exit
|
158
|
+
end
|
159
|
+
when "--httplog"
|
160
|
+
args[:AccessLog] = arg
|
161
|
+
when "--manifest"
|
162
|
+
master[:File] = arg
|
163
|
+
when "--noca"
|
164
|
+
haveca = false
|
165
|
+
when "--nonodes"
|
166
|
+
master[:UseNodes] = false
|
167
|
+
when "--parseonly"
|
168
|
+
parseonly = true
|
169
|
+
when "--port"
|
170
|
+
args[:Port] = arg
|
171
|
+
when "--ssldir"
|
172
|
+
Puppet[:ssldir] = arg
|
173
|
+
when "--logdest"
|
174
|
+
begin
|
175
|
+
Puppet[:logdest] = arg
|
176
|
+
rescue => detail
|
177
|
+
$stderr.puts detail.to_s
|
178
|
+
end
|
179
|
+
when "--vardir"
|
180
|
+
Puppet[:puppetvar] = arg
|
181
|
+
when "--version"
|
182
|
+
puts "%s" % Puppet.version
|
183
|
+
exit
|
184
|
+
when "--verbose"
|
185
|
+
Puppet[:loglevel] = :info
|
186
|
+
Puppet[:logdest] = :console
|
187
|
+
else
|
188
|
+
$stderr.puts "Invalid option '#{opt}'"
|
189
|
+
exit(1)
|
190
|
+
end
|
191
|
+
}
|
192
|
+
rescue GetoptLong::InvalidOption => detail
|
193
|
+
$stderr.puts "Try '#{$0} --help'"
|
194
|
+
#$stderr.puts detail
|
195
|
+
# FIXME RDoc::usage doesn't seem to work
|
196
|
+
#if $haveusage
|
197
|
+
# RDoc::usage(1,'usage')
|
198
|
+
#end
|
199
|
+
exit(1)
|
200
|
+
end
|
201
|
+
|
202
|
+
if Puppet[:loglevel] == :debug or Puppet[:loglevel] == :info or parseonly
|
203
|
+
args[:Daemonize] = false
|
204
|
+
else
|
205
|
+
args[:Daemonize] = true
|
206
|
+
end
|
207
|
+
|
208
|
+
handlers = {
|
209
|
+
:Master => master,
|
210
|
+
:Status => {},
|
211
|
+
:Logger => {}
|
212
|
+
}
|
213
|
+
|
214
|
+
|
215
|
+
if haveca
|
216
|
+
handlers[:CA] = ca
|
217
|
+
end
|
218
|
+
|
219
|
+
unless fs.include?(:Config)
|
220
|
+
if File.exists?(Puppet[:fileserverconfig])
|
221
|
+
fs[:Config] = Puppet[:fileserverconfig]
|
222
|
+
#else
|
223
|
+
# Puppet.notice "File server config %s does not exist; skipping file serving" %
|
224
|
+
# Puppet[:fileserverconfig]
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
if fs.include?(:Config)
|
229
|
+
handlers[:FileServer] = fs
|
230
|
+
end
|
231
|
+
|
232
|
+
args[:Handlers] = handlers
|
233
|
+
|
234
|
+
begin
|
235
|
+
# use the default, um, everything
|
236
|
+
#server = Puppet::Server.new(:CA => ca)
|
237
|
+
server = Puppet::Server.new(args)
|
238
|
+
rescue => detail
|
239
|
+
$stderr.puts detail
|
240
|
+
exit(1)
|
241
|
+
end
|
242
|
+
|
243
|
+
if parseonly
|
244
|
+
# we would have already exited if the file weren't syntactically correct
|
245
|
+
exit(0)
|
246
|
+
end
|
247
|
+
|
248
|
+
trap(:INT) {
|
249
|
+
server.shutdown
|
250
|
+
}
|
251
|
+
begin
|
252
|
+
server.start
|
253
|
+
rescue => detail
|
254
|
+
Puppet.err "Could not start puppetmaster: %s" % detail
|
255
|
+
exit(1)
|
256
|
+
end
|
257
|
+
|
258
|
+
# $Id: puppetmasterd 732 2005-10-28 05:39:59Z luke $
|