diff options
author | Brian Freeman <bf1936@att.com> | 2019-08-20 13:13:58 -0500 |
---|---|---|
committer | Daniel Rose <dr695h@att.com> | 2019-08-21 17:12:16 +0000 |
commit | 48d30546f897c3980186b886fa0635ca47bc500e (patch) | |
tree | 6d2ab89e6978ad38f09edab051c2c5c55ce40805 /deployment/onap-lab-ci/heat/grafana | |
parent | 7138060f1d84cf233a56e72403ca19113a553a95 (diff) |
Ingest onap-lab-ci jjb's
Issue-ID: INT-1215
Change-Id: I448fb7a147daa26d760df6c83fef75aa69f05879
Signed-off-by: Brian Freeman <bf1936@att.com>
Diffstat (limited to 'deployment/onap-lab-ci/heat/grafana')
-rw-r--r-- | deployment/onap-lab-ci/heat/grafana/grafana.yaml | 36 | ||||
-rw-r--r-- | deployment/onap-lab-ci/heat/grafana/grafana_vm_config.yaml | 61 |
2 files changed, 97 insertions, 0 deletions
diff --git a/deployment/onap-lab-ci/heat/grafana/grafana.yaml b/deployment/onap-lab-ci/heat/grafana/grafana.yaml new file mode 100644 index 000000000..c32342b90 --- /dev/null +++ b/deployment/onap-lab-ci/heat/grafana/grafana.yaml @@ -0,0 +1,36 @@ +heat_template_version: 2015-10-15 + +resources: + influxdb_data: + type: OS::Cinder::Volume + properties: + size: 100 + grafana: + type: OS::Nova::Server + properties: + name: grafana + image: bionic + flavor: m1.large + key_name: mykey + networks: + - network: c5ef4668-8a11-441d-8ce8-4a211a94885f + user_data_format: RAW + user_data: + str_replace: + params: + "%voldata_id%": { get_resource: influxdb_data } + template: + get_file: grafana_vm_config.yaml + influxdb_data_att: + type: OS::Cinder::VolumeAttachment + properties: + instance_uuid: { get_resource: grafana } + volume_id: { get_resource: influxdb_data } + +outputs: + instance_name: + description: Name of the instance. + value: { get_attr: [ grafana, name ] } + instance_ip: + description: IP address of the instance. + value: { get_attr: [ grafana, first_address ] } diff --git a/deployment/onap-lab-ci/heat/grafana/grafana_vm_config.yaml b/deployment/onap-lab-ci/heat/grafana/grafana_vm_config.yaml new file mode 100644 index 000000000..1151d7095 --- /dev/null +++ b/deployment/onap-lab-ci/heat/grafana/grafana_vm_config.yaml @@ -0,0 +1,61 @@ +#cloud-config +# vim: syntax=yaml +write_files: +- path: /opt/format-disks + permissions: '0700' + content: | + #!/bin/bash + voldata_id="%voldata_id%" + voldata_dev="/dev/disk/by-id/virtio-$(echo ${voldata_id} | cut -c -20)" + mkfs.ext4 ${voldata_dev} + mkdir -pv /var/lib/influxdb + echo "${voldata_dev} /var/lib/influxdb ext4 defaults 1 2" >> /etc/fstab + mount /var/lib/influxdb +- path: /opt/grafana_vm_entrypoint.sh + permissions: '0755' + content: | + #!/bin/bash -x + + printenv + + cp ~ubuntu/.ssh/authorized_keys /root/.ssh + + cat > /etc/apt/apt.conf.d/90curtin-aptproxy<<EOF + Acquire::http::Proxy "http://10.145.122.117:8000/"; + EOF + + source /etc/lsb-release + curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add - + echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list + curl https://packagecloud.io/gpg.key | sudo apt-key add - + echo "deb https://packagecloud.io/grafana/stable/debian/ stretch main" | sudo tee /etc/apt/sources.list.d/grafana.list + + apt-get update + + cat >> /etc/inputrc <<EOF + set show-all-if-ambiguous on + set show-all-if-unmodified on + set match-hidden-files off + set mark-symlinked-directories on + EOF + + export HOME=/root + apt-get -y install git + git config --global user.email "grafana@localhost" + git config --global user.name "grafana" + apt-get -y install etckeeper + + apt-get -y install influxdb + apt-get -y install grafana + + systemctl daemon-reload + + systemctl enable influxdb + systemctl start influxdb + + systemctl enable grafana-server.service + systemctl start grafana-server + +runcmd: +- /opt/format-disks +- /opt/grafana_vm_entrypoint.sh |