summaryrefslogtreecommitdiffstats
path: root/roles/base/files
diff options
context:
space:
mode:
authorKevin Fenzi <kevin@scrye.com>2016-12-01 21:36:07 +0000
committerKevin Fenzi <kevin@scrye.com>2016-12-01 21:36:07 +0000
commit1effd347df7032641d67d5db8581c01f5164a976 (patch)
tree546c46580c75c328dfe3120eeda88ba041ecc3ba /roles/base/files
parent181c1c7c32b3318bbb55b1e3a85f8052aabd0345 (diff)
downloadansible-1effd347df7032641d67d5db8581c01f5164a976.tar.gz
ansible-1effd347df7032641d67d5db8581c01f5164a976.tar.xz
ansible-1effd347df7032641d67d5db8581c01f5164a976.zip
Setup a proxyreload for httpd that looks for the ticketkey. If it's not there, assume the proxy is just being configured and don't reload httpd.
Diffstat (limited to 'roles/base/files')
-rw-r--r--roles/base/files/common-scripts/proxy-conditional-reload.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/roles/base/files/common-scripts/proxy-conditional-reload.sh b/roles/base/files/common-scripts/proxy-conditional-reload.sh
new file mode 100644
index 000000000..ef600875f
--- /dev/null
+++ b/roles/base/files/common-scripts/proxy-conditional-reload.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# reload SERVICE only if PACKAGE is installed.
+# We use this throughout handlers/restart_services.yml
+
+SERVICE=$1
+PACKAGE=$2
+
+rpm -q $PACKAGE
+
+INSTALLED=$?
+
+if [ ! -f /etc/httpd/ticketkey_*.tkey ]; then
+ # This host is not configured yet, do not try and restart httpd
+ exit 0
+fi
+
+if [ $INSTALLED -eq 0 ]; then
+ echo "Package $PACKAGE installed. Attempting reload of $SERVICE."
+ /sbin/service $SERVICE reload
+ exit $? # Exit with the /sbin/service status code
+fi
+
+# If the package wasn't installed, then pretend everything is fine.
+echo "Package $PACKAGE not installed. Skipping reload of $SERVICE."
+exit 0