|
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 | #
|
31 | 33 | # Actions:
|
32 | 34 | # - Install and configures the puppet agent
|
|
66 | 68 | $digest_algorithm = $::puppet::params::digest_algorithm,
|
67 | 69 | $configtimeout = '2m',
|
68 | 70 | $stringify_facts = undef,
|
| 71 | + $serialization_format = undef, |
| 72 | + $serialization_package = undef, |
69 | 73 | ) inherits puppet::params {
|
70 | 74 |
|
71 | 75 | if ! defined(User[$::puppet::params::puppet_user]) {
|
|
187 | 191 | path => $::puppet::params::puppet_conf,
|
188 | 192 | require => File[$::puppet::params::puppet_conf],
|
189 | 193 | section => 'agent',
|
| 194 | + ensure => present, |
190 | 195 | }
|
191 | 196 |
|
192 | 197 | if (($use_srv_records == true) and ($srv_domain == undef))
|
|
196 | 201 | elsif (($use_srv_records == true) and ($srv_domain != undef))
|
197 | 202 | {
|
198 | 203 | ini_setting {'puppetagentsrv_domain':
|
199 |
| - ensure => present, |
200 | 204 | setting => 'srv_domain',
|
201 | 205 | value => $srv_domain,
|
202 | 206 | }
|
|
233 | 237 | }
|
234 | 238 |
|
235 | 239 | ini_setting {'puppetagentenvironment':
|
236 |
| - ensure => present, |
237 | 240 | setting => 'environment',
|
238 | 241 | value => $environment,
|
239 | 242 | }
|
240 | 243 |
|
241 | 244 | ini_setting {'puppetagentmaster':
|
242 |
| - ensure => present, |
243 | 245 | setting => 'server',
|
244 | 246 | value => $puppet_server,
|
245 | 247 | }
|
246 | 248 |
|
247 | 249 | ini_setting {'puppetagentuse_srv_records':
|
248 |
| - ensure => present, |
249 | 250 | setting => 'use_srv_records',
|
250 | 251 | value => $use_srv_records,
|
251 | 252 | }
|
252 | 253 |
|
253 | 254 | ini_setting {'puppetagentruninterval':
|
254 |
| - ensure => present, |
255 | 255 | setting => 'runinterval',
|
256 | 256 | value => $runinterval,
|
257 | 257 | }
|
258 | 258 |
|
259 | 259 | ini_setting {'puppetagentsplay':
|
260 |
| - ensure => present, |
261 | 260 | setting => 'splay',
|
262 | 261 | value => $splay,
|
263 | 262 | }
|
264 | 263 |
|
265 | 264 | ini_setting {'puppetmasterport':
|
266 |
| - ensure => present, |
267 | 265 | setting => 'masterport',
|
268 | 266 | value => $puppet_server_port,
|
269 | 267 | }
|
270 | 268 | ini_setting {'puppetagentreport':
|
271 |
| - ensure => present, |
272 | 269 | setting => 'report',
|
273 | 270 | value => $report,
|
274 | 271 | }
|
275 | 272 | ini_setting {'puppetagentpluginsync':
|
276 |
| - ensure => present, |
277 | 273 | setting => 'pluginsync',
|
278 | 274 | value => $pluginsync,
|
279 | 275 | }
|
280 | 276 | ini_setting {'puppetagentlisten':
|
281 |
| - ensure => present, |
282 | 277 | setting => 'listen',
|
283 | 278 | value => $listen,
|
284 | 279 | }
|
285 | 280 | ini_setting {'puppetagentreportserver':
|
286 |
| - ensure => present, |
287 | 281 | setting => 'reportserver',
|
288 | 282 | value => $reportserver,
|
289 | 283 | }
|
290 | 284 | ini_setting {'puppetagentdigestalgorithm':
|
291 |
| - ensure => present, |
292 | 285 | setting => 'digest_algorithm',
|
293 | 286 | value => $digest_algorithm,
|
294 | 287 | }
|
295 | 288 | if ($templatedir != undef) and ($templatedir != 'undef')
|
296 | 289 | {
|
297 | 290 | ini_setting {'puppetagenttemplatedir':
|
298 |
| - ensure => present, |
299 | 291 | setting => 'templatedir',
|
300 | 292 | section => 'main',
|
301 | 293 | value => $templatedir,
|
|
310 | 302 | }
|
311 | 303 | }
|
312 | 304 | ini_setting {'puppetagentconfigtimeout':
|
313 |
| - ensure => present, |
314 | 305 | setting => 'configtimeout',
|
315 | 306 | value => $configtimeout,
|
316 | 307 | }
|
317 | 308 | if $stringify_facts != undef {
|
318 | 309 | ini_setting {'puppetagentstringifyfacts':
|
319 |
| - ensure => present, |
320 | 310 | setting => 'stringify_facts',
|
321 | 311 | value => $stringify_facts,
|
322 | 312 | }
|
323 | 313 | }
|
| 314 | + if $serialization_format != undef { |
| 315 | + if $serialization_package != undef { |
| 316 | + package { $serialization_package: |
| 317 | + ensure => latest, |
| 318 | + } |
| 319 | + } else { |
| 320 | + if $serialization_format == 'msgpack' { |
| 321 | + unless defined(Package[$::puppet::params::ruby_dev]) { |
| 322 | + package {$::puppet::params::ruby_dev: |
| 323 | + ensure => 'latest', |
| 324 | + } |
| 325 | + } |
| 326 | + unless defined(Package['gcc']) { |
| 327 | + package {'gcc': |
| 328 | + ensure => 'latest', |
| 329 | + } |
| 330 | + } |
| 331 | + unless defined(Package['msgpack']) { |
| 332 | + package {'msgpack': |
| 333 | + ensure => 'latest', |
| 334 | + provider => 'gem', |
| 335 | + require => Package[$::puppet::params::ruby_dev, 'gcc'], |
| 336 | + } |
| 337 | + } |
| 338 | + } |
| 339 | + } |
| 340 | + ini_setting {'puppetagentserializationformatagent': |
| 341 | + setting => 'preferred_serialization_format', |
| 342 | + value => $serialization_format, |
| 343 | + } |
| 344 | + } |
324 | 345 | }
|
0 commit comments