From d2123912bd5b29ea765317502218c370c3d72a40 Mon Sep 17 00:00:00 2001
From: Klas Arvidsson <klas.arvidsson@liu.se>
Date: Fri, 31 Jan 2020 17:07:38 +0100
Subject: [PATCH] examadm scripts update daily from git

---
 manifests/aes_sw.pp | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/manifests/aes_sw.pp b/manifests/aes_sw.pp
index a2e2976..2a5e52c 100644
--- a/manifests/aes_sw.pp
+++ b/manifests/aes_sw.pp
@@ -1,5 +1,9 @@
 class aes::aes_sw {
 
+  $examadm_user = examadm
+  $examadm_group = "${examadm_user}"
+  $examadm_home = "/home/${examadm_user}"
+
   package {
     [
       'a2ps',
@@ -80,4 +84,25 @@ class aes::aes_sw {
     ensure => "running",
   }
 
+  exec { 'script-repo-clone':
+    command => '/usr/bin/git clone --quiet --single-branch --branch master --depth 1 git@gitlab.liu.se:examadm/scripts.git',
+    cwd => "${examadm_home}",
+    creates => "${examadm_home}/scripts",
+    user => "${examadm_user}",
+    group => "${examadm_group}",
+  }
+
+  schedule { 'everyday':
+    period => daily,
+    range => '01:00 - 04:00',
+  }
+
+  exec { 'script-repo-pull':
+    command => '/usr/bin/git pull',
+    cwd => "${examadm_home}/scripts",
+    onlyif => "test -d ${examadm_home}/scripts/.git",
+    user => "${examadm_user}",
+    group => "${examadm_group}",
+    schedule => 'everyday',
+  }
 }
-- 
GitLab