|
27 | 27 | # ['templatedir'] - Template dir, if unset it will remove the setting.
|
28 | 28 | # ['configtimeout'] - How long the client should wait for the configuration to be retrieved before considering it a failure
|
29 | 29 | # ['stringify_facts'] - Wether puppet transforms structured facts in strings or no. Defaults to true in puppet < 4, deprecated in puppet >=4 (and will default to false)
|
| 30 | +# ['serialization_format'] - defaults to undef, otherwise it sets the preferred_serialization_format param (currently only msgpack is supported) |
| 31 | +# ['serialization_package'] - defaults to undef, if provided, we install this package, otherwise we fall back to the gem from 'serialization_format' |
30 | 32 | # ['cron_hour'] - What hour to run if puppet_run_style is cron
|
31 | 33 | # ['cron_minute'] - What minute to run if puppet_run_style is cron
|
32 | 34 | #
|
|
51 | 53 | $puppet_run_command = '/usr/bin/puppet agent --no-daemonize --onetime --logdest syslog > /dev/null 2>&1',
|
52 | 54 | $user_id = undef,
|
53 | 55 | $group_id = undef,
|
| 56 | + $serialization_format = undef, |
| 57 | + $serialization_package = undef, |
54 | 58 |
|
55 | 59 | #[main]
|
56 | 60 | $templatedir = undef,
|
|
206 | 210 | path => $::puppet::params::puppet_conf,
|
207 | 211 | require => File[$::puppet::params::puppet_conf],
|
208 | 212 | section => 'agent',
|
| 213 | + ensure => present, |
209 | 214 | }
|
210 | 215 |
|
211 | 216 | if (($use_srv_records == true) and ($srv_domain == undef))
|
|
215 | 220 | elsif (($use_srv_records == true) and ($srv_domain != undef))
|
216 | 221 | {
|
217 | 222 | ini_setting {'puppetagentsrv_domain':
|
218 |
| - ensure => present, |
219 | 223 | setting => 'srv_domain',
|
220 | 224 | value => $srv_domain,
|
221 | 225 | }
|
|
252 | 256 | }
|
253 | 257 |
|
254 | 258 | ini_setting {'puppetagentenvironment':
|
255 |
| - ensure => present, |
256 | 259 | setting => 'environment',
|
257 | 260 | value => $environment,
|
258 | 261 | }
|
259 | 262 |
|
260 | 263 | ini_setting {'puppetagentmaster':
|
261 |
| - ensure => present, |
262 | 264 | setting => 'server',
|
263 | 265 | value => $puppet_server,
|
264 | 266 | }
|
265 | 267 |
|
266 | 268 | ini_setting {'puppetagentuse_srv_records':
|
267 |
| - ensure => present, |
268 | 269 | setting => 'use_srv_records',
|
269 | 270 | value => $use_srv_records,
|
270 | 271 | }
|
271 | 272 |
|
272 | 273 | ini_setting {'puppetagentruninterval':
|
273 |
| - ensure => present, |
274 | 274 | setting => 'runinterval',
|
275 | 275 | value => $runinterval,
|
276 | 276 | }
|
277 | 277 |
|
278 | 278 | ini_setting {'puppetagentsplay':
|
279 |
| - ensure => present, |
280 | 279 | setting => 'splay',
|
281 | 280 | value => $splay,
|
282 | 281 | }
|
283 | 282 |
|
284 | 283 | ini_setting {'puppetmasterport':
|
285 |
| - ensure => present, |
286 | 284 | setting => 'masterport',
|
287 | 285 | value => $puppet_server_port,
|
288 | 286 | }
|
289 | 287 | ini_setting {'puppetagentreport':
|
290 |
| - ensure => present, |
291 | 288 | setting => 'report',
|
292 | 289 | value => $report,
|
293 | 290 | }
|
294 | 291 | ini_setting {'puppetagentpluginsync':
|
295 |
| - ensure => present, |
296 | 292 | setting => 'pluginsync',
|
297 | 293 | value => $pluginsync,
|
298 | 294 | }
|
299 | 295 | ini_setting {'puppetagentlisten':
|
300 |
| - ensure => present, |
301 | 296 | setting => 'listen',
|
302 | 297 | value => $listen,
|
303 | 298 | }
|
304 | 299 | ini_setting {'puppetagentreportserver':
|
305 |
| - ensure => present, |
306 | 300 | setting => 'reportserver',
|
307 | 301 | value => $reportserver,
|
308 | 302 | }
|
309 | 303 | ini_setting {'puppetagentdigestalgorithm':
|
310 |
| - ensure => present, |
311 | 304 | setting => 'digest_algorithm',
|
312 | 305 | value => $digest_algorithm,
|
313 | 306 | }
|
314 | 307 | if ($templatedir != undef) and ($templatedir != 'undef')
|
315 | 308 | {
|
316 | 309 | ini_setting {'puppetagenttemplatedir':
|
317 |
| - ensure => present, |
318 | 310 | setting => 'templatedir',
|
319 | 311 | section => 'main',
|
320 | 312 | value => $templatedir,
|
|
329 | 321 | }
|
330 | 322 | }
|
331 | 323 | ini_setting {'puppetagentconfigtimeout':
|
332 |
| - ensure => present, |
333 | 324 | setting => 'configtimeout',
|
334 | 325 | value => $configtimeout,
|
335 | 326 | }
|
336 | 327 | if $stringify_facts != undef {
|
337 | 328 | ini_setting {'puppetagentstringifyfacts':
|
338 |
| - ensure => present, |
339 | 329 | setting => 'stringify_facts',
|
340 | 330 | value => $stringify_facts,
|
341 | 331 | }
|
342 | 332 | }
|
| 333 | + if $serialization_format != undef { |
| 334 | + if $serialization_package != undef { |
| 335 | + package { $serialization_package: |
| 336 | + ensure => latest, |
| 337 | + } |
| 338 | + } else { |
| 339 | + if $serialization_format == 'msgpack' { |
| 340 | + unless defined(Package[$::puppet::params::ruby_dev]) { |
| 341 | + package {$::puppet::params::ruby_dev: |
| 342 | + ensure => 'latest', |
| 343 | + } |
| 344 | + } |
| 345 | + unless defined(Package['gcc']) { |
| 346 | + package {'gcc': |
| 347 | + ensure => 'latest', |
| 348 | + } |
| 349 | + } |
| 350 | + unless defined(Package['msgpack']) { |
| 351 | + package {'msgpack': |
| 352 | + ensure => 'latest', |
| 353 | + provider => 'gem', |
| 354 | + require => Package[$::puppet::params::ruby_dev, 'gcc'], |
| 355 | + } |
| 356 | + } |
| 357 | + } |
| 358 | + } |
| 359 | + ini_setting {'puppetagentserializationformatagent': |
| 360 | + setting => 'preferred_serialization_format', |
| 361 | + value => $serialization_format, |
| 362 | + } |
| 363 | + } |
343 | 364 | if $verbose != undef {
|
344 | 365 | ini_setting {'puppetagentverbose':
|
345 | 366 | ensure => present,
|
|
399 | 420 | }
|
400 | 421 | }
|
401 | 422 | }
|
| 423 | + |
0 commit comments