From d574c60f781797d64852f258614390b20c59ba61 Mon Sep 17 00:00:00 2001
From: Simon Michnowicz <simon.michnowicz@monash.edu>
Date: Wed, 26 Sep 2018 18:02:35 +1000
Subject: [PATCH] templates the external address to ping

Former-commit-id: 7ceade2180ff02ffccf3f40221694e8b36095c7f
---
 roles/nhc/templates/check_nat.nhc.j2 | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 roles/nhc/templates/check_nat.nhc.j2

diff --git a/roles/nhc/templates/check_nat.nhc.j2 b/roles/nhc/templates/check_nat.nhc.j2
new file mode 100644
index 00000000..8f64e3aa
--- /dev/null
+++ b/roles/nhc/templates/check_nat.nhc.j2
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+#checks that NAT is working by pinging an external address from a compute node
+
+function check_nat() {
+#echo ">>> Checking NAT on Compute Nodes Works >>>>>>>>>>>>>>>>>>>>>>>>>"
+
+
+#test NAT by pinging an external IP ADDRESS
+PING_EXTERNAL="ping -c 2 {{ EXTERNAL_IP_ADDRESS }}"
+ 
+$PING_EXTERNAL
+RESULT=$?
+if [ $RESULT -ne 0 ]; then
+     die 1 " $FUNCNAME ERROR on node. Can not ping external address. Command is ' ${PING_EXTERNAL} ' Please check NAT is working, or route on node is valid"
+     return 1
+fi
+return 0
+}
+
+
-- 
GitLab