Skip to content

Commit 8fd82d7

Browse files
committed
Telemetry installer
1 parent ab0beaf commit 8fd82d7

27 files changed

+478
-24
lines changed

ansible/group_vars/common.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ host_ip: 127.0.0.1
2727

2828
# This field indicates which project should be deploy
2929
# 'hotpot', 'gelato' or 'all'
30-
deploy_project: all
30+
deploy_project: telemetry
3131

3232
# This field indicates which way user prefers to install, currently support
3333
# 'repository', 'release' and 'container'
34-
install_from: release
34+
install_from: repository
3535
# These fields below will specify the tag based on install_from type
3636
repo_branch: master
3737
release_version: v0.10.0

ansible/group_vars/osdsdock.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dummy:
2525
# Change it according to your backend, currently support 'lvm', 'ceph', 'cinder', 'nfs', 'netapp_ontap_san'
2626
# DISABLE OR COMMENT "enabled_backends: lvm" IF YOU WANT TO INSTALL DIFFERENT BACKENDS ON MULTI-NODES AND mention it in "local.hosts" file
2727
# Comment this part if you want to use different backends on different nodes
28-
enabled_backends: lvm,nfs #For Multi-backend add backends here, for eg. enabled_backends: lvm,ceph,cinder,nfs
28+
enabled_backends: lvm #For Multi-backend add backends here, for eg. enabled_backends: lvm,ceph,cinder,nfs
2929

3030
# Change it according to your node type (host or target), currently support
3131
# 'provisioner', 'attacher'

ansible/group_vars/telemetry.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,30 @@ dummy:
2020
###########
2121
# GENERAL #
2222
###########
23+
apiserver_endpoint: "{{ host_ip }}:50040"
24+
controller_endpoint: "{{ host_ip }}:50049"
2325

24-
# Do you need to install or clean up telemetry tools?
25-
enable_telemetry_tools: false
26+
27+
# These fields are NOT suggested to be modified
28+
telemetry_work_dir: /opt/opensds-telemetry-linux-amd64
29+
opensds_config_dir: /etc/opensds
30+
opensds_driver_config_dir: "{{ opensds_config_dir }}/driver"
31+
opensds_log_dir: /var/log/opensds
32+
apiserver_log_file: "{{ opensds_log_dir }}/osdsapiserver.log"
33+
controller_log_file: "{{ opensds_log_dir }}/osdslet.log"
34+
dock_log_file: "{{ opensds_log_dir }}/osdsdock.log"
35+
36+
37+
##############
38+
# REPOSITORY #
39+
##############
40+
41+
# If user specifies intalling from repository, then he can choose the specific
42+
# repository branch
43+
telemetry_repo_branch: "{{ repo_branch }}"
44+
45+
# These fields are NOT suggested to be modified
46+
telemetry_remote_url: https://github.com/nguptaopensds/telemetry.git
2647

2748
# Grafana Repository config
2849
grafana_repositroy: "deb https://packages.grafana.com/oss/deb stable main"
@@ -50,4 +71,3 @@ kafka_endpoint: '{{ host_ip }}:9092'
5071
kafka_topic: metrics
5172

5273
opensds_conf_file: /etc/opensds/opensds.conf
53-
telemetry_work_dir: /opt/opensds-telemetry-linux-amd64

ansible/roles/osdsdock/scenarios/lvm.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
- name: create directory to volume group file
5454
file:
55-
path: "{{ hotpot_work_dir }}/volumegroups"
55+
path: "/opt/opensds-telemetry-linux-amd64/volumegroups"
5656
state: directory
5757
recurse: yes
5858

@@ -63,7 +63,7 @@
6363
local vg=$1
6464
local size=$2
6565
66-
local backing_file={{ hotpot_work_dir }}/volumegroups/${vg}.img
66+
local backing_file=/opt/opensds-telemetry-linux-amd64/volumegroups/${vg}.img
6767
if ! sudo vgs $vg; then
6868
# Only create if the file doesn't already exists
6969
[[ -f $backing_file ]] || truncate -s $size $backing_file
@@ -87,9 +87,9 @@
8787
if [[ -e {{ lvm_nvme_device }} ]]; then
8888
local vg={{ opensds_volume_group_nvme }}
8989
local size={{ opensds_volume_group_nvme_size }}
90-
sudo mkdir -p {{ hotpot_work_dir }}/volumegroups/{{ opensds_volume_group_nvme }}
91-
sudo mount {{ lvm_nvme_device }} {{ hotpot_work_dir }}/volumegroups/{{ opensds_volume_group_nvme }}
92-
local backing_file={{ hotpot_work_dir }}/volumegroups/{{ opensds_volume_group_nvme }}/${vg}.img
90+
sudo mkdir -p /opt/opensds-telemetry-linux-amd64/volumegroups/{{ opensds_volume_group_nvme }}
91+
sudo mount {{ lvm_nvme_device }} /opt/opensds-telemetry-linux-amd64/volumegroups/{{ opensds_volume_group_nvme }}
92+
local backing_file=/opt/opensds-telemetry-linux-amd64/volumegroups/{{ opensds_volume_group_nvme }}/${vg}.img
9393
if ! sudo vgs $vg; then
9494
# Only create if the file doesn't already exists
9595
[[ -f $backing_file ]] || truncate -s $size $backing_file

ansible/roles/osdsdock/tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@
8787
i="$((i+1))"
8888
[ "$i" -lt 4 ]
8989
do
90-
nohup bin/osdsdock > osdsdock.out 2> osdsdock.err < /dev/null &
90+
nohup bin/osdsdok > osdsdok.out 2> osdsdok.err < /dev/null &
9191
sleep 5
92-
ps aux | grep osdsdock | grep -v grep && break
92+
ps aux | grep osdsdok | grep -v grep && break
9393
done
9494
args:
95-
chdir: "{{ hotpot_work_dir }}"
95+
chdir: /opt/opensds-telemetry-linux-amd64
9696
when:
9797
- install_from != "container"
9898

ansible/roles/telemetry-installer/scenarios/install_telemetry_tools.yml

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,50 @@
1414

1515
---
1616
# ----Stop all services to all ansible re-run in case of failure-----
17+
- set_fact:
18+
go_path: "/root/gopath"
19+
20+
- name: check go_path
21+
shell: "{{ item }}"
22+
with_items:
23+
- echo "The environment variable GOPATH must be set and cannot be an empty string!"
24+
- /bin/false
25+
when: go_path == ""
26+
27+
- name: check for telemetry source code existed
28+
stat:
29+
path: "{{ go_path }}/src/github.com/sodafoundation/telemetry"
30+
register: telemetryexisted
31+
32+
- name: download telemetry source code if not exists
33+
git:
34+
repo: "{{ telemetry_remote_url }}"
35+
dest: "{{ go_path }}/src/github.com/sodafoundation/telemetry"
36+
version: "{{ telemetry_repo_branch }}"
37+
when: telemetryexisted.stat.exists is undefined or telemetryexisted.stat.exists == false
38+
39+
- name: build telemetry binary file
40+
shell: make
41+
environment:
42+
GOPATH: "{{ go_path }}"
43+
args:
44+
chdir: "{{ go_path }}/src/github.com/sodafoundation/telemetry"
45+
46+
- name: copy telemetry binary and openapi files into telemetry work directory
47+
copy:
48+
src: "{{ item.src }}"
49+
dest: "{{ item.dest }}"
50+
with_items:
51+
- { src: "{{ go_path }}/src/github.com/sodafoundation/telemetry/build/out/", dest: "{{ telemetry_work_dir }}" }
52+
- { src: "{{ go_path }}/src/github.com/opensds/opensds/openapi-spec/", dest: "{{ telemetry_work_dir }}" }
53+
54+
- name: change the permissions of telemetry executable files
55+
file:
56+
path: "{{ telemetry_work_dir }}/bin"
57+
state: directory
58+
mode: 0755
59+
recurse: yes
60+
1761
- name: stop all services
1862
shell: "{{ item }}"
1963
with_items:
@@ -61,7 +105,7 @@
61105
path: "{{ telemetry_work_dir }}"
62106
state: directory
63107
when:
64-
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == false
108+
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == true
65109

66110
- name: download and extract the telemetry, prometheus
67111
unarchive:
@@ -70,7 +114,7 @@
70114
remote_src: yes
71115
become: yes
72116
when:
73-
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == False
117+
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == true
74118

75119
- name: download and extract the telemetry, node_exporter
76120
unarchive:
@@ -79,7 +123,7 @@
79123
remote_src: yes
80124
become: yes
81125
when:
82-
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == False
126+
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == true
83127

84128
- name: download and extract the telemetry, pushgateway
85129
unarchive:
@@ -88,7 +132,7 @@
88132
remote_src: yes
89133
become: yes
90134
when:
91-
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == False
135+
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == true
92136

93137
- name: download and extract the telemetry, alertmanager
94138
unarchive:
@@ -97,7 +141,7 @@
97141
remote_src: yes
98142
become: yes
99143
when:
100-
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == False
144+
- telemetryfilesexisted.stat.exists is undefined or telemetryfilesexisted.stat.exists == true
101145

102146
- name: install prometheus
103147
shell: "{{ item }}"
@@ -241,6 +285,7 @@
241285
- cp /opt/opensds-hotpot-linux-amd64/bin/lvm_exporter /usr/local/bin/
242286
- chown root:root /usr/local/bin/lvm_exporter
243287
become: yes
288+
ignore_errors: yes
244289

245290
- name: edit lvm_exporter.service
246291
shell: "{{ item }}"
@@ -266,6 +311,7 @@
266311
with_items:
267312
- systemctl status lvm_exporter
268313
become: yes
314+
ignore_errors: yes
269315

270316
- name: configuring prometheus to scrape lvm_exporter
271317
tags:
@@ -290,6 +336,8 @@
290336
with_items:
291337
- systemctl status prometheus
292338
become: yes
339+
ignore_errors: yes
340+
293341
# ---------start to install alertmanager---------
294342
- name: install alertmanager
295343
shell: "{{ item }}"
@@ -371,4 +419,4 @@
371419
with_items:
372420
- systemctl start grafana-server
373421
- systemctl status grafana-server
374-
become: yes
422+
become: yes
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copyright 2019 The OpenSDS Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
---
16+
- name: run osdslet daemon service
17+
shell:
18+
cmd: |
19+
i=0
20+
while
21+
i="$((i+1))"
22+
[ "$i" -lt 4 ]
23+
do
24+
nohup bin/osdslet > osdslet.out 2> osdslet.err < /dev/null &
25+
sleep 5
26+
ps aux | grep osdslet | grep -v grep && break
27+
done
28+
args:
29+
chdir: "{{ telemetry_work_dir }}"
30+
31+
- name: run osdsapiserver daemon service
32+
shell:
33+
cmd: |
34+
i=0
35+
while
36+
i="$((i+1))"
37+
[ "$i" -lt 4 ]
38+
do
39+
nohup bin/osdsapiserver > osdsapiserver.out 2> osdsapiserver.err < /dev/null &
40+
sleep 5
41+
ps aux | grep osdsapiserver | grep -v grep && break
42+
done
43+
args:
44+
chdir: "{{ telemetry_work_dir }}"

0 commit comments

Comments
 (0)