Skip to content

Commit b4a1493

Browse files
author
Tim Meusel
committed
add preferred_serialization_format and msgpack support
more information here https://docs.puppetlabs.com/puppet/latest/reference/experiments_msgpack.html#docs-»-experimental-features:-msgpack-support add general support for preferred_serialization_format in master and agent, also install msgpack if needed
1 parent fc66d30 commit b4a1493

File tree

3 files changed

+37
-17
lines changed

3 files changed

+37
-17
lines changed

manifests/agent.pp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# ['templatedir'] - Template dir, if unset it will remove the setting.
2828
# ['configtimeout'] - How long the client should wait for the configuration to be retrieved before considering it a failure
2929
# ['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)
3031
#
3132
# Actions:
3233
# - Install and configures the puppet agent
@@ -66,6 +67,7 @@
6667
$digest_algorithm = $::puppet::params::digest_algorithm,
6768
$configtimeout = '2m',
6869
$stringify_facts = undef,
70+
$serialization_format = undef,
6971
) inherits puppet::params {
7072

7173
if ! defined(User[$::puppet::params::puppet_user]) {
@@ -187,6 +189,7 @@
187189
path => $::puppet::params::puppet_conf,
188190
require => File[$::puppet::params::puppet_conf],
189191
section => 'agent',
192+
ensure => present,
190193
}
191194

192195
if (($use_srv_records == true) and ($srv_domain == undef))
@@ -196,15 +199,13 @@
196199
elsif (($use_srv_records == true) and ($srv_domain != undef))
197200
{
198201
ini_setting {'puppetagentsrv_domain':
199-
ensure => present,
200202
setting => 'srv_domain',
201203
value => $srv_domain,
202204
}
203205
}
204206
elsif($use_srv_records == false)
205207
{
206208
ini_setting {'puppetagentsrv_domain':
207-
ensure => absent,
208209
setting => 'srv_domain',
209210
}
210211
}
@@ -233,69 +234,57 @@
233234
}
234235

235236
ini_setting {'puppetagentenvironment':
236-
ensure => present,
237237
setting => 'environment',
238238
value => $environment,
239239
}
240240

241241
ini_setting {'puppetagentmaster':
242-
ensure => present,
243242
setting => 'server',
244243
value => $puppet_server,
245244
}
246245

247246
ini_setting {'puppetagentuse_srv_records':
248-
ensure => present,
249247
setting => 'use_srv_records',
250248
value => $use_srv_records,
251249
}
252250

253251
ini_setting {'puppetagentruninterval':
254-
ensure => present,
255252
setting => 'runinterval',
256253
value => $runinterval,
257254
}
258255

259256
ini_setting {'puppetagentsplay':
260-
ensure => present,
261257
setting => 'splay',
262258
value => $splay,
263259
}
264260

265261
ini_setting {'puppetmasterport':
266-
ensure => present,
267262
setting => 'masterport',
268263
value => $puppet_server_port,
269264
}
270265
ini_setting {'puppetagentreport':
271-
ensure => present,
272266
setting => 'report',
273267
value => $report,
274268
}
275269
ini_setting {'puppetagentpluginsync':
276-
ensure => present,
277270
setting => 'pluginsync',
278271
value => $pluginsync,
279272
}
280273
ini_setting {'puppetagentlisten':
281-
ensure => present,
282274
setting => 'listen',
283275
value => $listen,
284276
}
285277
ini_setting {'puppetagentreportserver':
286-
ensure => present,
287278
setting => 'reportserver',
288279
value => $reportserver,
289280
}
290281
ini_setting {'puppetagentdigestalgorithm':
291-
ensure => present,
292282
setting => 'digest_algorithm',
293283
value => $digest_algorithm,
294284
}
295285
if ($templatedir != undef) and ($templatedir != 'undef')
296286
{
297287
ini_setting {'puppetagenttemplatedir':
298-
ensure => present,
299288
setting => 'templatedir',
300289
section => 'main',
301290
value => $templatedir,
@@ -310,15 +299,28 @@
310299
}
311300
}
312301
ini_setting {'puppetagentconfigtimeout':
313-
ensure => present,
314302
setting => 'configtimeout',
315303
value => $configtimeout,
316304
}
317305
if $stringify_facts != undef {
318306
ini_setting {'puppetagentstringifyfacts':
319-
ensure => present,
320307
setting => 'stringify_facts',
321308
value => $stringify_facts,
322309
}
323310
}
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+
}
324326
}

manifests/master.pp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
# ['dns_alt_names'] - Comma separated list of alternative DNS names
3434
# ['digest_algorithm'] - The algorithm to use for file digests.
3535
# ['generate_ssl_certs'] - Generate ssl certs (false to disable)
36+
# ['serialization_format'] - defaults to undef, otherwise it sets the preferred_serialization_format param (currently only msgpack is supported)
3637
#
3738
# Requires:
3839
#
@@ -87,6 +88,7 @@
8788
$digest_algorithm = $::puppet::params::digest_algorithm,
8889
$generate_ssl_certs = true,
8990
$puppetdb_version = 'present',
91+
$serialization_format = undef,
9092
) inherits puppet::params {
9193

9294
anchor { 'puppet::master::begin': }
@@ -313,6 +315,20 @@
313315
setting => 'digest_algorithm',
314316
value => $digest_algorithm,
315317
}
316-
318+
if $serialization_format != undef {
319+
if $serialization_format == 'msgpack' {
320+
package {$::puppet::params::ruby_dev:
321+
ensure => 'latest',
322+
} ->
323+
package {'msgpack':
324+
ensure => 'latest',
325+
provide => 'gem',
326+
}
327+
}
328+
ini_setting {'puppetagentserializationformat':
329+
setting => 'preferred_serialization_format',
330+
value => $serialization_format
331+
}
332+
}
317333
anchor { 'puppet::master::end': }
318334
}

manifests/params.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
$puppet_ssldir = '/var/lib/puppet/ssl'
4848
$passenger_package = 'mod_passenger'
4949
$rack_package = 'rubygem-rack'
50+
$ruby_dev = 'ruby-devel'
5051
}
5152
'Suse': {
5253
$puppet_master_package = 'puppet-server'
@@ -70,6 +71,7 @@
7071
$puppet_ssldir = '/var/lib/puppet/ssl'
7172
$passenger_package = 'libapache2-mod-passenger'
7273
$rack_package = 'librack-ruby'
74+
$ruby_dev = 'ruby-dev'
7375
}
7476
'FreeBSD': {
7577
$puppet_agent_service = 'puppet'

0 commit comments

Comments
 (0)