-
Notifications
You must be signed in to change notification settings - Fork 1
/
nomad_tls
executable file
·67 lines (53 loc) · 1.16 KB
/
nomad_tls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
SRC="/opt/nomad/tls"
CONFIG_DIR="/etc/nomad.d"
APP="nomad"
function yaydone {
ls -al ${DEST}/${APP}
${DEST}/${APP} version
exit 0
}
function switchversion {
if [[ -L ${DEST}/${APP} ]]
then
echo -n "Removing existing and "
rm -f ${DEST}/${APP}
fi
echo "Creating symlink for version ${TargetVersion}"
ln -s ${SRC}/${APP}-${1} ${DEST}/${APP}
yaydone
}
function checkDeps {
if ! svn --version --quiet
then
echo " * Installing Subversion dependency"
sudo yum install -y svn
fi
}
function printUsage {
echo "This will be usage information..."
}
function generateConfigFile {
echo "" > tls.hcl
}
# usage
# install
checkDeps
if [[ ! -d /opt/nomad/tls ]]
then
echo " * Creating /opt/nomad/tls..."
mkdir /opt/nomad/tls
fi
if [[ ! -f /opt/nomad/tls/server.key ]]
then
echo " * Downloading and installing TLS certificates from hashicorp/nomad..."
mkdir /tmp/nomad_tls
cd /tmp/nomad_tls
echo " - copying files with SVN - this is slooooow."
svn export https://github.com/hashicorp/nomad/trunk/dev/tls_cluster/certs
echo " - done"
mv certs /opt/nomad/tls
cd -
rmdir /tmp/nomad_tls
fi
# uninstall