|
33 | 33 | # ['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)
|
34 | 34 | # ['cron_hour'] - What hour to run if puppet_run_style is cron
|
35 | 35 | # ['cron_minute'] - What minute to run if puppet_run_style is cron
|
| 36 | +# ['serialization_format'] - defaults to undef, otherwise it sets the preferred_serialization_format param (currently only msgpack is supported) |
| 37 | +# ['serialization_package'] - defaults to undef, if provided, we install this package, otherwise we fall back to the gem from 'serialization_format' |
36 | 38 | #
|
37 | 39 | # Actions:
|
38 | 40 | # - Install and configures the puppet agent
|
|
93 | 95 | $http_proxy_port = undef,
|
94 | 96 | $cron_hour = '*',
|
95 | 97 | $cron_minute = undef,
|
| 98 | + $serialization_format = undef, |
| 99 | + $serialization_package = undef, |
96 | 100 | ) inherits puppet::params {
|
97 | 101 |
|
98 | 102 | if ! defined(User[$::puppet::params::puppet_user]) {
|
|
218 | 222 | path => $::puppet::params::puppet_conf,
|
219 | 223 | require => File[$::puppet::params::puppet_conf],
|
220 | 224 | section => 'agent',
|
| 225 | + ensure => present, |
221 | 226 | }
|
222 | 227 |
|
223 | 228 | if (($use_srv_records == true) and ($srv_domain == undef))
|
|
227 | 232 | elsif (($use_srv_records == true) and ($srv_domain != undef))
|
228 | 233 | {
|
229 | 234 | ini_setting {'puppetagentsrv_domain':
|
230 |
| - ensure => present, |
231 | 235 | setting => 'srv_domain',
|
232 | 236 | value => $srv_domain,
|
233 | 237 | }
|
|
264 | 268 | }
|
265 | 269 |
|
266 | 270 | ini_setting {'puppetagentenvironment':
|
267 |
| - ensure => present, |
268 | 271 | setting => 'environment',
|
269 | 272 | value => $environment,
|
270 | 273 | }
|
271 | 274 |
|
272 | 275 | ini_setting {'puppetagentmaster':
|
273 |
| - ensure => present, |
274 | 276 | setting => 'server',
|
275 | 277 | value => $puppet_server,
|
276 | 278 | }
|
277 | 279 |
|
278 | 280 | ini_setting {'puppetagentuse_srv_records':
|
279 |
| - ensure => present, |
280 | 281 | setting => 'use_srv_records',
|
281 | 282 | value => $use_srv_records,
|
282 | 283 | }
|
283 | 284 |
|
284 | 285 | ini_setting {'puppetagentruninterval':
|
285 |
| - ensure => present, |
286 | 286 | setting => 'runinterval',
|
287 | 287 | value => $runinterval,
|
288 | 288 | }
|
289 | 289 |
|
290 | 290 | ini_setting {'puppetagentsplay':
|
291 |
| - ensure => present, |
292 | 291 | setting => 'splay',
|
293 | 292 | value => $splay,
|
294 | 293 | }
|
|
306 | 305 | }
|
307 | 306 |
|
308 | 307 | ini_setting {'puppetmasterport':
|
309 |
| - ensure => present, |
310 | 308 | setting => 'masterport',
|
311 | 309 | value => $puppet_server_port,
|
312 | 310 | }
|
313 | 311 | ini_setting {'puppetagentreport':
|
314 |
| - ensure => present, |
315 | 312 | setting => 'report',
|
316 | 313 | value => $report,
|
317 | 314 | }
|
318 | 315 | ini_setting {'puppetagentpluginsync':
|
319 |
| - ensure => present, |
320 | 316 | setting => 'pluginsync',
|
321 | 317 | value => $pluginsync,
|
322 | 318 | }
|
323 | 319 | ini_setting {'puppetagentlisten':
|
324 |
| - ensure => present, |
325 | 320 | setting => 'listen',
|
326 | 321 | value => $listen,
|
327 | 322 | }
|
328 | 323 | ini_setting {'puppetagentreportserver':
|
329 |
| - ensure => present, |
330 | 324 | setting => 'reportserver',
|
331 | 325 | value => $reportserver,
|
332 | 326 | }
|
333 | 327 | ini_setting {'puppetagentdigestalgorithm':
|
334 |
| - ensure => present, |
335 | 328 | setting => 'digest_algorithm',
|
336 | 329 | value => $digest_algorithm,
|
337 | 330 | }
|
338 | 331 | if ($templatedir != undef) and ($templatedir != 'undef')
|
339 | 332 | {
|
340 | 333 | ini_setting {'puppetagenttemplatedir':
|
341 |
| - ensure => present, |
342 | 334 | setting => 'templatedir',
|
343 | 335 | section => 'main',
|
344 | 336 | value => $templatedir,
|
|
353 | 345 | }
|
354 | 346 | }
|
355 | 347 | ini_setting {'puppetagentconfigtimeout':
|
356 |
| - ensure => present, |
357 | 348 | setting => 'configtimeout',
|
358 | 349 | value => $configtimeout,
|
359 | 350 | }
|
360 | 351 | if $stringify_facts != undef {
|
361 | 352 | ini_setting {'puppetagentstringifyfacts':
|
362 |
| - ensure => present, |
363 | 353 | setting => 'stringify_facts',
|
364 | 354 | value => $stringify_facts,
|
365 | 355 | }
|
|
430 | 420 | value => $http_proxy_port,
|
431 | 421 | }
|
432 | 422 | }
|
| 423 | + if $serialization_format != undef { |
| 424 | + if $serialization_package != undef { |
| 425 | + package { $serialization_package: |
| 426 | + ensure => latest, |
| 427 | + } |
| 428 | + } else { |
| 429 | + if $serialization_format == 'msgpack' { |
| 430 | + unless defined(Package[$::puppet::params::ruby_dev]) { |
| 431 | + package {$::puppet::params::ruby_dev: |
| 432 | + ensure => 'latest', |
| 433 | + } |
| 434 | + } |
| 435 | + unless defined(Package['gcc']) { |
| 436 | + package {'gcc': |
| 437 | + ensure => 'latest', |
| 438 | + } |
| 439 | + } |
| 440 | + unless defined(Package['msgpack']) { |
| 441 | + package {'msgpack': |
| 442 | + ensure => 'latest', |
| 443 | + provider => 'gem', |
| 444 | + require => Package[$::puppet::params::ruby_dev, 'gcc'], |
| 445 | + } |
| 446 | + } |
| 447 | + } |
| 448 | + } |
| 449 | + ini_setting {'puppetagentserializationformatagent': |
| 450 | + setting => 'preferred_serialization_format', |
| 451 | + value => $serialization_format, |
| 452 | + } |
| 453 | + } |
433 | 454 | }
|
0 commit comments