puppet-swift/manifests/ringbuilder/create.pp
Adam Vinsh c659733d39 Add hooks for external install & svc management
This adds defined anchor points for external modules to hook into the
software install, config and service dependency chain.  This allows
external modules to manage software installation (virtualenv,
containers, etc) and service management (pacemaker) without needing rely
on resources that may change or be renamed.

Change-Id: I00cf4846bb933291469be94c9debed425eddf798
2016-05-25 08:52:47 -04:00

55 lines
1.4 KiB
Puppet

# Creates a swift ring using ringbuilder.
# It creates the associated ring file as /etc/swift/${name}.builder
# It will not create a ring if the file already exists.
#
# == Parameters
#
# [*name*] The type of ring to create. Accepts object|container|account
# [*part_power*] Number of partitions in the ring. (specified as the power of 2)
# Optional. Defaults to 18 (2^18)
# [*replicas*] Number of replicas to store.
# Optional. Defaults to 3
# [*min_part_hours*] Time before a partition can be moved.
# Optional. Defaults to 24.
# [*user*] User to run as
# Optional. Defaults to 'swift'
#
# == Examples
#
# swift::ringbuilder::create { 'account':
# part_power => 19,
# replicas => 5,
# min_part_hours => 1,
# user => 'swift',
# }
#
# == Authors
#
# Pupppetlabs <info@puppetlabs.com>
#
# == Copyright
#
# Copyright 2011 Puppetlabs Inc, unless otherwise noted.
#
define swift::ringbuilder::create(
$part_power = 18,
$replicas = 3,
$min_part_hours = 24,
$user = 'swift'
) {
include ::swift::deps
validate_re($name, '^object|container|account$')
exec { "create_${name}":
command => "swift-ring-builder /etc/swift/${name}.builder create ${part_power} ${replicas} ${min_part_hours}",
path => ['/usr/bin'],
user => $user,
creates => "/etc/swift/${name}.builder",
before => Anchor['swift::config::end'],
}
}