-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre_hook
executable file
·54 lines (46 loc) · 1.33 KB
/
pre_hook
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
#!/bin/bash
set -eux
ROOT="$(dirname "$(readlink -f "$0")")"
MODULES_DIR="${ROOT}"/deployment_scripts/puppet/modules
RPM_REPO="${ROOT}"/repositories/centos/
DEB_REPO="${ROOT}"/repositories/ubuntu/
function download_packages {
while [ $# -gt 0 ]; do
FILENAME=$(basename "$1")
EXT=${FILENAME##*.}
case ${EXT} in
deb) REPO=$DEB_REPO;;
rpm) REPO=$RPM_REPO;;
esac
rm -f "$REPO"/"$FILENAME"
wget -qO - "$1" > "$REPO"/"$FILENAME"
shift
done
}
echo "creating influxdb and grafana repositories"
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 0
gpgkey = https://repos.influxdata.com/influxdb.key
EOF
cat <<EOF | sudo tee /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packagecloud.io/grafana/stable/el/6/\$basearch
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
EOF
echo "Installing all required packages"
yum install -y influxdb
yum install -y grafana
systemctl start grafana
systemctl enable grafana
systemctl start influxdb
systemctl enable influxdb