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