Dzahn has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/361811 )

Change subject: Create rsync::quickdatacopy
......................................................................


Create rsync::quickdatacopy

Designed for setting up quick rsync migration bridges. Use case
will be pretty evident in follow-up commit

Change-Id: I9f5d328cd17eb03ea8cacdce1bfb0ef65ba041a7
---
A modules/rsync/manifests/quickdatacopy.pp
A modules/rsync/templates/quickdatacopy.erb
2 files changed, 59 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/modules/rsync/manifests/quickdatacopy.pp 
b/modules/rsync/manifests/quickdatacopy.pp
new file mode 100644
index 0000000..3674036
--- /dev/null
+++ b/modules/rsync/manifests/quickdatacopy.pp
@@ -0,0 +1,56 @@
+# == Class rsync::quickdatacopy
+#
+# This class sets up a very quick and dirty rsync server. It's designed to be
+# used for copying data between two (or more) machines, mostly for migrations.
+#
+# Since it's meant to be used for data migrations, it assumes the source and
+# destination locations are the same
+#
+# === Parameters
+#
+# [*source_host*] What machine are we copying data from
+#
+# [*module_path*] What path are we giving to rsync as the docroot for syncing 
from
+#
+# [*file_path*] What file within that document root do we need?
+#
+# [*ensure*] The usual meaning, set to absent to clean up when done
+#
+define rsync::quickdatacopy(
+  $source_host,
+  $module_path,
+  $file_path = '*',
+  $ensure = present,
+  ) {
+
+      include rsync::server
+
+      ferm::service { $title:
+          ensure => $ensure,
+          proto  => 'tcp',
+          port   => 873,
+          srange => "@resolve(${source_host})",
+      }
+
+      rsync::server::module { $title:
+          ensure    => $ensure,
+          read_only => 'yes',
+          path      => $module_path,
+      }
+
+      file { "/usr/local/sbin/${title}":
+          ensure  => $ensure,
+          owner   => 'root',
+          group   => 'root',
+          mode    => '0755',
+          content => template('rsync/quickdatacopy.erb'),
+      }
+
+      if $source_host != $::fqdn {
+          cron { 'sync-rsync-data':
+              ensure  => $ensure,
+              minute  => '*/10',
+              command => "/usr/local/sbin/${title} >/dev/null 2>&1",
+          }
+      }
+}
diff --git a/modules/rsync/templates/quickdatacopy.erb 
b/modules/rsync/templates/quickdatacopy.erb
new file mode 100644
index 0000000..44dc67a
--- /dev/null
+++ b/modules/rsync/templates/quickdatacopy.erb
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/usr/bin/rsync -a rsync://<%= @source_host %>/<%= @title %>/<%= @file_path %> 
<%= @module_path %>/<%= @file_path %>

-- 
To view, visit https://gerrit.wikimedia.org/r/361811
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9f5d328cd17eb03ea8cacdce1bfb0ef65ba041a7
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to