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

Change subject: aptrepo: add cron to rsync APT data automatically
......................................................................


aptrepo: add cron to rsync APT data automatically

After testing the rsync setup and manually running the
command, syncing data from carbon to install1002 and install2002,
now add a cron job to make that automatic.

For the moment we will still sync from carbon as source, and over
to install2002.

Bug: T84380
Bug: T132757
Change-Id: I0f3570890d5c949db98763b3f1ad5bcb0f35d23c
---
M hieradata/common.yaml
M modules/aptrepo/manifests/rsync.pp
2 files changed, 21 insertions(+), 5 deletions(-)

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



diff --git a/hieradata/common.yaml b/hieradata/common.yaml
index c328d2b..0b80ce6 100644
--- a/hieradata/common.yaml
+++ b/hieradata/common.yaml
@@ -453,4 +453,6 @@
         id: 2003
 
 deployment_server: tin.eqiad.wmnet
+
 install_server: carbon.wikimedia.org
+install_server_failover: install1002.wikimedia.org
diff --git a/modules/aptrepo/manifests/rsync.pp 
b/modules/aptrepo/manifests/rsync.pp
index df647d7..9eabac9 100644
--- a/modules/aptrepo/manifests/rsync.pp
+++ b/modules/aptrepo/manifests/rsync.pp
@@ -2,17 +2,21 @@
 # activates rsync for push from the primary to secondary
 class aptrepo::rsync {
 
-    $primary_server = hiera('install_server', 'install1001.wikimedia.org')
+    $primary_server = hiera('install_server', 'install1002.wikimedia.org')
+    $secondary_server = hiera('install_server_failover', 
'install2002.wikimedia.org')
 
     # only activate rsync/firewall hole on the server that is NOT active
     if $::fqdn != $primary_server {
 
-        $ensure = 'present'
+        $ensure_ferm = 'present'
+        $ensure_cron = 'absent'
+        $ensure_sync = 'present'
+
         include rsync::server
 
         # just APT data (/srv/wikimedia/)
         rsync::server::module { 'aptrepo':
-            ensure      => $aptrepo::rsync::ensure,
+            ensure      => $ensure_sync,
             path        => $aptrepo::basedir,
             read_only   => 'no',
             hosts_allow => $primary_server,
@@ -26,13 +30,23 @@
         }
 
     } else {
-        $ensure = 'absent'
+        $ensure_ferm = 'absent'
+        $ensure_cron = 'present'
+        $ensure_sync = 'absent'
     }
 
     ferm::service { 'aptrepo-rsync':
-        ensure => $aptrepo::rsync::ensure,
+        ensure => $ensure_ferm,
         proto  => 'tcp',
         port   => '873',
         srange => "@resolve(${primary_server})",
     }
+
+    cron { 'rsync-aptrepo':
+        ensure  => $ensure_cron,
+        user    => 'root',
+        command => "rsync -avp ${aptrepo::basedir} 
rsync://${secondary_server}/aptrepo",
+        hour    => '*/6',
+        minute  => '42',
+    }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0f3570890d5c949db98763b3f1ad5bcb0f35d23c
Gerrit-PatchSet: 7
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn <dz...@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