File: server.pp

package info (click to toggle)
puppet-module-swift 25.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,400 kB
  • sloc: ruby: 9,593; python: 38; sh: 10; makefile: 10
file content (634 lines) | stat: -rw-r--r-- 27,505 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
# == Define: swift::storage::server
#
# Configures an account, container or object server
#
# === Parameters:
#
# [*type*]
#   (required) The type of device, e.g. account, object, or container.
#
# [*storage_local_net_ip*]
#   (required) This is the ip that the storage service will bind to when it starts.
#
# [*bind_port*]
#   (optional) The port the server will be exposed to Usually 6000, 6001 and
#   6002 for respectively object, container and account.
#   Defaults to $name
#
# [*devices*]
#   (optional) The directory where the physical storage device will be mounted.
#   Defaults to '/srv/node'.
#
# [*rsync_module_per_device*]
#   (optional) Define one rsync module per device. If this is set to true, then
#   the device_names must be set with an array of device names.
#   Defaults to false.
#
# [*device_names*]
#   (optional) List of devices to set as an rsync module list in rsyncd.conf.
#   Defaults to an empty array.
#
# [*owner*]
#   (optional) Owner (uid) of rsync server.
#   Defaults to $::swift::params::user.
#
# [*group*]
#   (optional) Group (gid) of rsync server.
#   Defaults to $::swift::params::group.
#
# [*max_connections*]
#   (optional) maximum number of simultaneous connections allowed.
#   Defaults to 25.
#
# [*hosts_allow*]
#   (optional) List of patterns allowed to connect to this module
#   Defaults to undef.
#
# [*hosts_deny*]
#   (optional) List of patterns not allowed to connect to this module
#   Defaults to undef.
#
# [*incoming_chmod*] Incoming chmod to set in the rsync server.
#   (optional) Defaults to 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r'
#   This mask translates to 0755 for directories and 0644 for files.
#
# [*outgoing_chmod*] Outgoing chmod to set in the rsync server.
#   (optional) Defaults to 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r'
#   This mask translates to 0755 for directories and 0644 for files.
#
# [*pipeline*]
#   (optional) Pipeline of applications.
#   Defaults to ["${type}-server"].
#
# [*mount_check*]
#   (optional) Whether or not check if the devices are mounted to prevent accidentally
#   writing to the root device.
#   Defaults to true.
#
# [*disable_fallocate*]
#   (optional) Disable pre-allocating the required disk space.
#   Defaults to $facts['os_service_default'].
#
# [*fallocate_reserve*]
#   (optional) The number of bytes or percentage of disk space kept free at
#   all times.
#   Defaults to $facts['os_service_default'].
#
# [*server_fallocate_reserve*]
#   (optional) The number of bytes or percentage of disk space kept free at
#   all times. This option affects only <type>-server processes.
#   Defaults to $facts['os_service_default'].
#
# [*db_preallocation*]
#   (optional) Preallocate disk space with SQLite database to decrease
#   fragmentation.
#   Defaults to $facts['os_service_default'].
#
# [*servers_per_port*]
#   (optional) Spawn multiple servers per device on different ports.
#   Make object-server run this many worker processes per unique port of
#   "local" ring devices across all storage policies.  This can help provide
#   the isolation of threads_per_disk without the severe overhead.  The default
#   value of 0 disables this feature.
#   Default to $facts['os_service_default'].
#
# [*user*]
#   (optional) User to run as
#   Defaults to $::swift::params::user.
#
# [*workers*]
#   (optional) Override the number of pre-forked workers that will accept
#   connections. If set it should be an integer, zero means no fork. If unset,
#   it will try to default to the number of effective cpu cores and fallback to
#   one. Increasing the number of workers may reduce the possibility of slow file
#   system operations in one request from negatively impacting other requests.
#   See https://docs.openstack.org/swift/latest/deployment_guide.html#general-service-tuning
#   Defaults to $facts['os_workers'].
#
# [*conn_timeout*]
#   (optional) Connection timeout to external services.
#   Default to $facts['os_service_default'].
#
# [*node_timeout*]
#   (optional) Request timeout to external seivices.
#   Default to $facts['os_service_default'].
#
# [*replicator_concurrency*]
#   (optional) Number of replicator workers to spawn.
#   Defaults to 1.
#
# [*replicator_interval*]
#   (optional) Minimum time for a pass to take, in seconds.
#   Default to $facts['os_service_default'].
#
# [*replicator_conn_timeout*]
#   (optional) Connection timeout to external services.
#   Default to $facts['os_service_default'].
#
# [*replicator_node_timeout*]
#   (optional) Request timeout to external seivices.
#   Default to $facts['os_service_default'].
#
# [*updater_concurrency*]
#   (optional) Number of updater workers to spawn.
#   Defaults to 1.
#
# [*updater_interval*]
#   (optional) Minimum time for a pass to take, in seconds.
#   Default to $facts['os_service_default'].
#
# [*updater_conn_timeout*]
#   (optional) Connection timeout to external services.
#   Default to $facts['os_service_default'].
#
# [*updater_node_timeout*]
#   (optional) Request timeout to external seivices.
#   Default to $facts['os_service_default'].
#
# [*reaper_concurrency*]
#   (optional) Number of reaper workers to spawn.
#   Defaults to 1.
#
# [*reaper_interval*]
#   (optional) Minimum time for a pass to take, in seconds.
#   Default to $facts['os_service_default'].
#
# [*reaper_conn_timeout*]
#   (optional) Connection timeout to external services.
#   Default to $facts['os_service_default'].
#
# [*reaper_node_timeout*]
#   (optional) Request timeout to external seivices.
#   Default to $facts['os_service_default'].
#
# [*log_facility*]
#   (optional) Syslog log facility.
#   Defaults to 'LOG_LOCAL2'.
#
# [*log_level*]
#   (optional) Logging level.
#   Defaults to 'INFO'.
#
# [*log_address*]
#   (optional) Location where syslog sends the logs to.
#   Defaults to '/dev/log'.
#
# [*log_name*]
#   (optional) Label used when logging.
#   Defaults to "${type}-server".
#
# [*log_name_per_daemon*]
#   (optional) Set log_name according differently for each daemon
#   For example: container-replicator, contaier-sharder, etc.
#   Defaults to false.
#
# [*log_udp_host*]
#   (optional) If not set, the UDP receiver for syslog is disabled.
#   Defaults to undef.
#
# [*log_udp_port*]
#   (optional) Port value for UDP receiver, if enabled.
#   Defaults to undef.
#
# [*log_requests*]
#   (optional) Whether or not log every request. reduces logging output if false,
#   good for seeing errors if true
#   Defaults to true.
#
# [*statsd_enabled*]
#   (optional) Should statsd configuration items be writen out to config files
#   Defaults to false.
#
# [*log_statsd_host*]
#   (optional) statsd host to send data to.
#   Defaults to 'localhost'
#
# [*log_statsd_port*]
#   (optional) statsd port to send data to.
#   Defaults to $facts['os_service_default'].
#
# [*log_statsd_default_sample_rate*]
#   (optional) Default sample rate for data. This should be a number between 0
#   and 1. According to the documentation this should be set to 1 and the
#   sample rate factor should be adjusted.
#   Defaults to $facts['os_service_default'].
#
# [*log_statsd_sample_rate_factor*]
#   (optional) sample rate factor for data.
#   Defaults to $facts['os_service_default'].
#
# [*log_statsd_metric_prefix*]
#   (optional) Prefix for data being sent to statsd.
#   Defaults to $facts['os_service_default']
#
# [*network_chunk_size*]
#   (optional) Size of chunks to read/write over the network.
#   Default to $facts['os_service_default'].
#
# [*disk_chunk_size*]
#   (optional) Size of chunks to read/write to disk.
#   Default to $facts['os_service_default'].
#
# [*auditor_disk_chunk_size*]
#   (optional) Object-auditor size of chunks to read/write to disk.
#   Default to $facts['os_service_default'].
#
# [*client_timeout*]
#   (optional) Object-server timeout in seconds to read one chunk from a client
#   external services.
#   Default to $facts['os_service_default'].
#
# [*rsync_timeout*]
#   (optional) Max duration of a partition rsync.
#   Default to $facts['os_service_default'].
#
# [*rsync_bwlimit*]
#   (optional) Bandwidth limit for rsync in kB/s. 0 means unlimited.
#   Default to $facts['os_service_default'].
#
# [*splice*]
#   (optional) Use splice for zero-copy object GETs. This requires Linux Kernel
#   version 3.0 or greater.
#   Default to $facts['os_service_default'].
#
# [*object_server_mb_per_sync*]
#   (optional) Number of MB allocated for the cache.
#   Default to $facts['os_service_default'].
#
# [*container_sharder_auto_shard*]
#   (optional) If the auto_shard option is true then the sharder will
#   automatically select containers to shard, scan for shard ranges,
#   and select shards to shrink.
#   Default to $facts['os_service_default'].
#
# [*container_sharder_concurrency*]
#   (optional) Number of replication workers to spawn.
#   Default to $facts['os_service_default'].
#
# [*container_sharder_interval*]
#   (optional) Time in seconds to wait between sharder cycles.
#   Default to $facts['os_service_default'].
#
# [*container_sharder_conn_timeout*]
#   (optional) Connection timeout to external services.
#   Default to $facts['os_service_default'].
#
# [*container_sharder_node_timeout*]
#   (optional) Request timeout to external seivices.
#   Default to $facts['os_service_default'].
#
# [*purge_config*]
#   (optional) Whether to set only the specified config options
#   in the config file.
#   Defaults to false.
#
define swift::storage::server(
  Swift::StorageServerType $type,
  $storage_local_net_ip,
  Pattern[/^\d+$/] $bind_port                            = $name,
  $devices                                               = '/srv/node',
  Boolean $rsync_module_per_device                       = false,
  Array[String[1]] $device_names                         = [],
  $owner                                                 = undef,
  $group                                                 = undef,
  $max_connections                                       = 25,
  $hosts_allow                                           = undef,
  $hosts_deny                                            = undef,
  $incoming_chmod                                        = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
  $outgoing_chmod                                        = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
  Swift::Pipeline $pipeline                              = ["${type}-server"],
  $mount_check                                           = true,
  $disable_fallocate                                     = $facts['os_service_default'],
  $fallocate_reserve                                     = $facts['os_service_default'],
  $server_fallocate_reserve                              = $facts['os_service_default'],
  $db_preallocation                                      = $facts['os_service_default'],
  $servers_per_port                                      = $facts['os_service_default'],
  $user                                                  = undef,
  $workers                                               = $facts['os_workers'],
  $conn_timeout                                          = $facts['os_service_default'],
  $node_timeout                                          = $facts['os_service_default'],
  $replicator_concurrency                                = 1,
  $replicator_interval                                   = $facts['os_service_default'],
  $replicator_conn_timeout                               = $facts['os_service_default'],
  $replicator_node_timeout                               = $facts['os_service_default'],
  $updater_concurrency                                   = 1,
  $updater_interval                                      = $facts['os_service_default'],
  $updater_conn_timeout                                  = $facts['os_service_default'],
  $updater_node_timeout                                  = $facts['os_service_default'],
  $reaper_concurrency                                    = 1,
  $reaper_interval                                       = $facts['os_service_default'],
  $reaper_conn_timeout                                   = $facts['os_service_default'],
  $reaper_node_timeout                                   = $facts['os_service_default'],
  $log_facility                                          = 'LOG_LOCAL2',
  $log_level                                             = 'INFO',
  $log_address                                           = '/dev/log',
  $log_name                                              = "${type}-server",
  Boolean $log_name_per_daemon                           = false,
  $log_udp_host                                          = $facts['os_service_default'],
  $log_udp_port                                          = $facts['os_service_default'],
  $log_requests                                          = true,
  # this parameters needs to be specified after type and name
  Boolean $statsd_enabled                                = false,
  $log_statsd_host                                       = 'localhost',
  $log_statsd_port                                       = $facts['os_service_default'],
  $log_statsd_default_sample_rate                        = $facts['os_service_default'],
  $log_statsd_sample_rate_factor                         = $facts['os_service_default'],
  $log_statsd_metric_prefix                              = $facts['os_service_default'],
  $network_chunk_size                                    = $facts['os_service_default'],
  $disk_chunk_size                                       = $facts['os_service_default'],
  $client_timeout                                        = $facts['os_service_default'],
  $auditor_disk_chunk_size                               = $facts['os_service_default'],
  $rsync_timeout                                         = $facts['os_service_default'],
  $rsync_bwlimit                                         = $facts['os_service_default'],
  Variant[Openstacklib::ServiceDefault, Boolean] $splice = $facts['os_service_default'],
  $object_server_mb_per_sync                             = $facts['os_service_default'],
  # These parameters only apply to container-server.conf,
  # and define options for the container-sharder service.
  $container_sharder_auto_shard                          = $facts['os_service_default'],
  $container_sharder_concurrency                         = $facts['os_service_default'],
  $container_sharder_interval                            = $facts['os_service_default'],
  $container_sharder_conn_timeout                        = $facts['os_service_default'],
  $container_sharder_node_timeout                        = $facts['os_service_default'],
  Boolean $purge_config                                  = false,
){

  include swift::deps
  include swift::params

  $user_real = pick($user, $::swift::params::user)

  # Fail if ${type-server} isn't included in the pipeline
  if $pipeline[-1] != "${type}-server" {
    fail("${type}-server must be the last element in pipeline")
  }

  include "::swift::storage::${type}"

  # rsync::server should be included before rsync::server::module
  include swift::storage
  if $rsync_module_per_device {
    if empty($device_names) {
      fail('device_names is required when rsync_module_per_device is true')
    }

    $device_names.each |String $device_name| {
      rsync::server::module { "${type}_${device_name}":
        path            => $devices,
        lock_file       => "/var/lock/${type}_${device_name}.lock",
        uid             => pick($owner, $::swift::params::user),
        gid             => pick($group, $::swift::params::group),
        hosts_allow     => $hosts_allow,
        hosts_deny      => $hosts_deny,
        incoming_chmod  => $incoming_chmod,
        outgoing_chmod  => $outgoing_chmod,
        max_connections => $max_connections,
        read_only       => false,
      }
    }
    $rsync_module = "{replication_ip}::${type}_{device}"
  } else {
    rsync::server::module { $type:
      path            => $devices,
      lock_file       => "/var/lock/${type}.lock",
      uid             => pick($owner, $::swift::params::user),
      gid             => pick($group, $::swift::params::group),
      hosts_allow     => $hosts_allow,
      hosts_deny      => $hosts_deny,
      incoming_chmod  => $incoming_chmod,
      outgoing_chmod  => $outgoing_chmod,
      max_connections => $max_connections,
      read_only       => false,
    }
    $rsync_module = $facts['os_service_default']
  }

  $config_file_full_path = "/etc/swift/${type}-server.conf"

  $required_middlewares = split(
    inline_template(
      "<%=
        (@pipeline - ['${type}-server']).collect do |x|
          'Swift::Storage::Filter::' + x.capitalize + '[${type}]'
        end.join(',')
      %>"), ',')

  file { $config_file_full_path:
    ensure => 'file',
    owner  => 'root',
    group  => pick($group, $::swift::params::group),
    mode   => '0640',
    tag    => 'swift-config-file',
    before => $required_middlewares,
  }

  resources { "swift_${type}_config":
    purge => $purge_config,
  }

  # common settings
  $common_opts = {
    'DEFAULT/devices'                      => {'value'  => $devices},
    'DEFAULT/bind_ip'                      => {'value'  => $storage_local_net_ip},
    'DEFAULT/bind_port'                    => {'value'  => $bind_port},
    'DEFAULT/mount_check'                  => {'value'  => $mount_check},
    'DEFAULT/disable_fallocate'            => {'value'  => $disable_fallocate},
    'DEFAULT/fallocate_reserve'            => {'value'  => $fallocate_reserve},
    'DEFAULT/user'                         => {'value'  => $user_real},
    'DEFAULT/workers'                      => {'value'  => $workers},
    'DEFAULT/conn_timeout'                 => {'value'  => $conn_timeout},
    'DEFAULT/node_timeout'                 => {'value'  => $node_timeout},
    'DEFAULT/log_name'                     => {'value'  => $log_name},
    'DEFAULT/log_facility'                 => {'value'  => $log_facility},
    'DEFAULT/log_level'                    => {'value'  => $log_level},
    'DEFAULT/log_address'                  => {'value'  => $log_address},
    'DEFAULT/log_udp_host'                 => {'value'  => $log_udp_host},
    'DEFAULT/log_udp_port'                 => {'value'  => $log_udp_port},
    # pipeline
    'pipeline:main/pipeline'               => {'value'  => join($pipeline, ' ')},
    # server
    "app:${type}-server/use"               => {'value'  => "egg:swift#${type}"},
    "app:${type}-server/set log_name"      => {'value'  => $log_name},
    "app:${type}-server/set log_facility"  => {'value'  => $log_facility},
    "app:${type}-server/set log_level"     => {'value'  => $log_level},
    "app:${type}-server/set log_requests"  => {'value'  => $log_requests},
    "app:${type}-server/set log_address"   => {'value'  => $log_address},
    "app:${type}-server/fallocate_reserve" => {'value'  => $server_fallocate_reserve},
    # auditor
    "${type}-auditor/"                     => {'ensure' => present},
    # replicator
    "${type}-replicator/"                  => {'ensure' => present},
    "${type}-replicator/rsync_module"      => {'value'  => $rsync_module},
  }

  Anchor['swift::config::begin']
    -> File[$config_file_full_path]
    ~> Anchor['swift::config::end']

  # statsd
  if $statsd_enabled {
    $log_statsd_opts = {
      'DEFAULT/log_statsd_host'                => {'value' => $log_statsd_host},
      'DEFAULT/log_statsd_port'                => {'value' => $log_statsd_port},
      'DEFAULT/log_statsd_default_sample_rate' => {'value' => $log_statsd_default_sample_rate},
      'DEFAULT/log_statsd_sample_rate_factor'  => {'value' => $log_statsd_sample_rate_factor},
      'DEFAULT/log_statsd_metric_prefix'       => {'value' => $log_statsd_metric_prefix},
    }
  } else {
    $log_statsd_opts = {
      'DEFAULT/log_statsd_host'                => {'value' => $facts['os_service_default']},
      'DEFAULT/log_statsd_port'                => {'value' => $facts['os_service_default']},
      'DEFAULT/log_statsd_default_sample_rate' => {'value' => $facts['os_service_default']},
      'DEFAULT/log_statsd_sample_rate_factor'  => {'value' => $facts['os_service_default']},
      'DEFAULT/log_statsd_metric_prefix'       => {'value' => $facts['os_service_default']},
    }
  }

  case $type {
    'account': {
      $type_opts = {
        'DEFAULT/db_preallocation'        => {'value'  => $db_preallocation},
        # account-server
        # account-auditor
        # account-replicator
        'account-replicator/concurrency'  => {'value'  => $replicator_concurrency},
        'account-replicator/interval'     => {'value'  => $replicator_interval},
        'account-replicator/conn_timeout' => {'value'  => $replicator_conn_timeout},
        'account-replicator/node_timeout' => {'value'  => $replicator_node_timeout},
        # account-reaper
        'account-reaper/'                 => {'ensure' => present},
        'account-reaper/concurrency'      => {'value'  => $reaper_concurrency},
        'account-reaper/interval'         => {'value'  => $reaper_interval},
        'account-reaper/conn_timeout'     => {'value'  => $reaper_conn_timeout},
        'account-reaper/node_timeout'     => {'value'  => $reaper_node_timeout},
      }

      if $log_name_per_daemon {
        $log_name_opts = {
          'account-auditor/log_name'    => {'value' => 'account-auditor'},
          'account-replicator/log_name' => {'value' => 'account-replicator'},
          'account-reaper/log_name'     => {'value' => 'account-reaper'},
        }
      } else {
        $log_name_opts = {
          'account-auditor/log_name'    => {'ensure' => absent},
          'account-replicator/log_name' => {'ensure' => absent},
          'account-reaper/log_name'     => {'ensure' => absent},
        }
      }
    }
    'container': {
      $type_opts = {
        'DEFAULT/db_preallocation'          => {'value'  => $db_preallocation},
        'DEFAULT/allowed_sync_hosts'        => {'value'  => join($::swift::storage::container::allowed_sync_hosts, ',')},
        # container-server
        # container-auditor
        # container-replicator
        'container-replicator/concurrency'  => {'value'  => $replicator_concurrency},
        'container-replicator/interval'     => {'value'  => $replicator_interval},
        'container-replicator/conn_timeout' => {'value'  => $replicator_conn_timeout},
        'container-replicator/node_timeout' => {'value'  => $replicator_node_timeout},
        # container-updater
        'container-updater/'                => {'ensure' => present},
        'container-updater/concurrency'     => {'value'  => $updater_concurrency},
        'container-updater/interval'        => {'value'  => $updater_interval},
        'container-updater/conn_timeout'    => {'value'  => $updater_conn_timeout},
        'container-updater/node_timeout'    => {'value'  => $updater_node_timeout},
        # container-sync
        'container-sync/'                   => {'ensure' => present},
        # container-sharder
        'container-sharder/'                => {'ensure' => present},
        'container-sharder/auto_shard'      => {'value'  => $container_sharder_auto_shard},
        'container-sharder/concurrency'     => {'value'  => $container_sharder_concurrency},
        'container-sharder/interval'        => {'value'  => $container_sharder_interval},
        'container-sharder/conn_timeout'    => {'value'  => $container_sharder_conn_timeout},
        'container-sharder/node_timeout'    => {'value'  => $container_sharder_node_timeout},
      }

      if $log_name_per_daemon {
        $log_name_opts = {
          'container-auditor/log_name'    => {'value' => 'container-auditor'},
          'container-replicator/log_name' => {'value' => 'container-replicator'},
          'container-updater/log_name'    => {'value' => 'container-updater'},
          'container-sync/log_name'       => {'value' => 'container-sync'},
          'container-sharder/log_name'    => {'value' => 'container-sharder'},
        }
      } else {
        $log_name_opts = {
          'container-auditor/log_name'    => {'ensure' => absent},
          'container-replicator/log_name' => {'ensure' => absent},
          'container-updater/log_name'    => {'ensure' => absent},
          'container-sync/log_name'       => {'ensure' => absent},
          'container-sharder/log_name'    => {'ensure' => absent},
        }
      }

      file { '/etc/swift/container-sync-realms.conf':
        ensure => 'file',
        owner  => 'root',
        group  => pick($group, $::swift::params::group),
        mode   => '0640',
        tag    => 'swift-config-file',
      }
      File['/etc/swift/container-sync-realms.conf'] -> Swift_container_sync_realms_config<||>
    }
    'object': {
      $type_opts = {
        'DEFAULT/servers_per_port'        => {'value'  => $servers_per_port},
        'DEFAULT/network_chunk_size'      => {'value'  => $network_chunk_size},
        'DEFAULT/disk_chunk_size'         => {'value'  => $disk_chunk_size},
        'DEFAULT/client_timeout'          => {'value'  => $client_timeout},
        # object-server
        'app:object-server/splice'        => {'value'  => $splice},
        'app:object-server/mb_per_sync'   => {'value'  => $object_server_mb_per_sync},
        # object-auditor
        'object-auditor/disk_chunk_size'  => {'value'  => $auditor_disk_chunk_size},
        # object-replicator
        'object-replicator/concurrency'   => {'value'  => $replicator_concurrency},
        'object-replicator/conn_timeout'  => {'value'  => $replicator_conn_timeout},
        'object-replicator/node_timeout'  => {'value'  => $replicator_node_timeout},
        'object-replicator/rsync_timeout' => {'value'  => $rsync_timeout},
        'object-replicator/rsync_bwlimit' => {'value'  => $rsync_bwlimit},
        # object-updater
        'object-updater/'                 => {'ensure' => present},
        'object-updater/concurrency'      => {'value'  => $updater_concurrency},
        'object-updater/interval'         => {'value'  => $updater_interval},
        'object-updater/conn_timeout'     => {'value'  => $updater_conn_timeout},
        'object-updater/node_timeout'     => {'value'  => $updater_node_timeout},
        # object-reconstructor
        'object-reconstructor/'           => {'ensure' => present},
        # object-relinker
        'object-relinker/'                => {'ensure' => present},
      }

      if $log_name_per_daemon {
        $log_name_opts = {
          'object-auditor/log_name'       => {'value' => 'object-auditor'},
          'object-replicator/log_name'    => {'value' => 'object-replicator'},
          'object-updater/log_name'       => {'value' => 'object-updater'},
          'object-reconstructor/log_name' => {'value' => 'object-reconstructor'},
          'object-relinker/log_name'      => {'value' => 'object-relinker'},
        }
      } else {
        $log_name_opts = {
          'object-auditor/log_name'       => {'ensure' => absent},
          'object-replicator/log_name'    => {'ensure' => absent},
          'object-updater/log_name'       => {'ensure' => absent},
          'object-reconstructor/log_name' => {'ensure' => absent},
          'object-relinker/log_name'      => {'ensure' => absent},
        }
      }
    }
    default: {
      # nothing to do
    }
  }

  create_resources("swift_${type}_config", merge(
    $common_opts,
    $log_statsd_opts,
    $type_opts,
    $log_name_opts,
  ), {
    'require' => File[$config_file_full_path]
  })
}