blob: 1151d709582e07adf8b696fe797a2636e5a7cf0a [file] [log] [blame]
Brian Freeman48d30542019-08-20 13:13:58 -05001#cloud-config
2# vim: syntax=yaml
3write_files:
4- path: /opt/format-disks
5 permissions: '0700'
6 content: |
7 #!/bin/bash
8 voldata_id="%voldata_id%"
9 voldata_dev="/dev/disk/by-id/virtio-$(echo ${voldata_id} | cut -c -20)"
10 mkfs.ext4 ${voldata_dev}
11 mkdir -pv /var/lib/influxdb
12 echo "${voldata_dev} /var/lib/influxdb ext4 defaults 1 2" >> /etc/fstab
13 mount /var/lib/influxdb
14- path: /opt/grafana_vm_entrypoint.sh
15 permissions: '0755'
16 content: |
17 #!/bin/bash -x
18
19 printenv
20
21 cp ~ubuntu/.ssh/authorized_keys /root/.ssh
22
23 cat > /etc/apt/apt.conf.d/90curtin-aptproxy<<EOF
24 Acquire::http::Proxy "http://10.145.122.117:8000/";
25 EOF
26
27 source /etc/lsb-release
28 curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
29 echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
30 curl https://packagecloud.io/gpg.key | sudo apt-key add -
31 echo "deb https://packagecloud.io/grafana/stable/debian/ stretch main" | sudo tee /etc/apt/sources.list.d/grafana.list
32
33 apt-get update
34
35 cat >> /etc/inputrc <<EOF
36 set show-all-if-ambiguous on
37 set show-all-if-unmodified on
38 set match-hidden-files off
39 set mark-symlinked-directories on
40 EOF
41
42 export HOME=/root
43 apt-get -y install git
44 git config --global user.email "grafana@localhost"
45 git config --global user.name "grafana"
46 apt-get -y install etckeeper
47
48 apt-get -y install influxdb
49 apt-get -y install grafana
50
51 systemctl daemon-reload
52
53 systemctl enable influxdb
54 systemctl start influxdb
55
56 systemctl enable grafana-server.service
57 systemctl start grafana-server
58
59runcmd:
60- /opt/format-disks
61- /opt/grafana_vm_entrypoint.sh