From 6fed9719eda82e30a54c8f379aea2850af660f6d Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 14 Mar 2012 05:45:17 +0000 Subject: [PATCH] Add code for ring syncing This commit adds puppet code to handle syncing of the ring databases. The class swift::ringserver is used to set up an rsync server that serve out the ring databases. The define swift::ringsync is used to rsync these ring databases to the other hosts. --- manifests/ringserver.pp | 39 +++++++++++++++++++++++++++++++++++++++ manifests/ringsync.pp | 10 ++++++++++ 2 files changed, 49 insertions(+) create mode 100644 manifests/ringserver.pp create mode 100644 manifests/ringsync.pp diff --git a/manifests/ringserver.pp b/manifests/ringserver.pp new file mode 100644 index 00000000..14b75839 --- /dev/null +++ b/manifests/ringserver.pp @@ -0,0 +1,39 @@ +# Used to create an rsync server to serve up the ring databases via rsync +# +# == Parameters +# +# == Dependencies +# +# Class['swift'] +# +# == Examples +# +# == Authors +# +# Dan Bode dan@puppetlabs.com +# +# == Copyright +# +# Copyright 2011 Puppetlabs Inc, unless otherwise noted. +# +class swift::ringserver( + $local_net_ip, + $max_connections = 5 +) { + + Class['ringbuilder'] -> Class['swift::ringserver'] + + class { 'rsync::server': + use_xinetd => true, + address => $local_net_ip, + } + + rsync::server::module { "swift_server": + path => '/etc/swift', + lock_file => "/var/lock/swift_server.lock", + uid => 'swift', + gid => 'swift', + max_connections => $max_connections, + read_only => true, + } +} diff --git a/manifests/ringsync.pp b/manifests/ringsync.pp new file mode 100644 index 00000000..c84c5df5 --- /dev/null +++ b/manifests/ringsync.pp @@ -0,0 +1,10 @@ +define swift::ringsync( + $ring_server +) { + + Exec { path => '/usr/bin' } + + rsync::get { "/etc/swift/${name}.ring.gz": + source => "rsync://${ring_server}/swift_server/${name}.ring.gz", + } +}