[puppet] Land a fishpoll hook to remotely update the /etc/puppet git clone



commit 4c454e6e82a5241336889f5b839ee0367367a3f0
Author: Andrea Veri <averi redhat com>
Date:   Wed Apr 3 13:03:59 2019 +0200

    Land a fishpoll hook to remotely update the /etc/puppet git clone

 manifests/nodes/puppetmaster01.pp          |  1 +
 modules/fishpoll/files/hooks/puppetmasters | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
---
diff --git a/manifests/nodes/puppetmaster01.pp b/manifests/nodes/puppetmaster01.pp
index 50d19495..9e5eb36b 100644
--- a/manifests/nodes/puppetmaster01.pp
+++ b/manifests/nodes/puppetmaster01.pp
@@ -31,4 +31,5 @@ node puppetmaster01 {
     }
 
     fishpoll::hook { 'update_gitadmin_bin': }
+    fishpoll::hook { 'puppetmasters': }
 }
diff --git a/modules/fishpoll/files/hooks/puppetmasters b/modules/fishpoll/files/hooks/puppetmasters
new file mode 100644
index 00000000..b2634977
--- /dev/null
+++ b/modules/fishpoll/files/hooks/puppetmasters
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+BINDIR=/home/admin/bin/git
+PUPPETREPO="/etc/puppet"
+
+if [ -d "${PUPPETREPO}" ]; then
+    cd "${PUPPETREPO}"
+
+    git checkout -f > /dev/null 2>&1 
+    git pull > /dev/null 2>&1
+    chmod 770 $PUPPETREPO/{private,hieradata,private/hiera-keys}
+    find $PUPPETREPO/private/ -type f | xargs sudo chmod 660
+    find $PUPPETREPO/hieradata/ -type f | xargs sudo chmod 660
+else
+    echo "Unable to access the ${PUPPETREPO} directory. Bailing out. \n"
+    exit 1
+fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]