
Previously, all of the storage server types (account, container, proxy) were always configured to be installed on the same node. It often makes sense to only have the account and container together, and to put the object server on a different node. (or its possible that other configurations make sense) This commit refactors the swift module so that each of the types of nodes can be built independently of each other.
60 lines
1.4 KiB
Puppet
60 lines
1.4 KiB
Puppet
# Creates the files packages and services that are
|
|
# needed to deploy each type of storage server.
|
|
#
|
|
# == Parameters
|
|
# [*package_ensure*] The desired ensure state of the swift storage packages.
|
|
# Optional. Defaults to present.
|
|
# [*service_provider*] The provider to use for the service
|
|
#
|
|
# == Dependencies
|
|
# Requires Class[swift::storage]
|
|
# == Examples
|
|
#
|
|
# == Authors
|
|
#
|
|
# Dan Bode dan@puppetlabs.com
|
|
#
|
|
# == Copyright
|
|
#
|
|
# Copyright 2011 Puppetlabs Inc, unless otherwise noted.
|
|
define swift::storage::generic(
|
|
$package_ensure = 'present',
|
|
$service_provider = 'upstart'
|
|
) {
|
|
|
|
Class['swift::storage'] -> Swift::Storage::Generic[$name]
|
|
|
|
validate_re($name, '^object|container|account$')
|
|
|
|
package { "swift-${name}":
|
|
ensure => $package_ensure,
|
|
}
|
|
|
|
file { "/etc/swift/${name}-server/":
|
|
ensure => directory,
|
|
owner => 'swift',
|
|
group => 'swift',
|
|
}
|
|
|
|
service { "swift-${name}":
|
|
ensure => running,
|
|
enable => true,
|
|
hasstatus => true,
|
|
provider => $service_provider,
|
|
subscribe => Service['rsync'],
|
|
}
|
|
|
|
swift::storage::generic::upstart { $name: }
|
|
|
|
}
|
|
# TODO this should be removed when the upstart packages are fixed.
|
|
define swift::storage::generic::upstart() {
|
|
file { "/etc/init/swift-${name}.conf":
|
|
mode => '0644',
|
|
owner => 'root',
|
|
group => 'root',
|
|
source => "puppet:///modules/swift/swift-${name}.conf.upstart",
|
|
before => Service["swift-${name}"],
|
|
}
|
|
}
|