]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/role/manifests/backup.pp
Add a way to specify a port for backup hosts
[perso/Immae/Projets/Puppet.git] / modules / role / manifests / backup.pp
index 51b689d4a891feb84c40b01b7ae66fb6f606dc9f..bdc35d5326966c36335d188c9e9ffb07f5e2edce 100644 (file)
@@ -14,17 +14,10 @@ class role::backup (
   include "profile::xmr_stak"
   include "profile::known_hosts"
   include "profile::boinc"
+  include "profile::monitoring"
 
   include "role::backup::postgresql"
 
-  ensure_packages(["python", "python-pip"])
-  package { "pylog2rotate":
-    source   => "git+https://github.com/avian2/pylog2rotate",
-    ensure   => present,
-    provider => "pip3",
-    require  => Package["python-pip"],
-  }
-
   ensure_packages(["rsync"])
 
   ssh_keygen { $user:
@@ -77,6 +70,7 @@ class role::backup (
     $dirname = $infos["name"]
     $login = $infos["login"]
     $host = $infos["host"]
+    $port = if $infos.dig("port") { $infos.dig("port") } else { 22 }
     $dest = "$login@$host"
     $base = "$mountpoint/$dirname"
     $nbr  = $infos["nbr"]
@@ -132,5 +126,11 @@ class role::backup (
         order   => "$order_dirname-$order_part",
       }
     }
+
+    @profile::monitoring::local_service { "Last backup in $base is not too old":
+      local => {
+        check_command => "check_last_file_date!$base!14",
+      }
+    }
   }
 }