Skip to content

Commit 19259ba

Browse files
committed
Telemetry installer
1 parent ab0beaf commit 19259ba

27 files changed

+477
-17
lines changed

ansible/group_vars/common.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ dummy:
2323
###########
2424

2525
# This field indicates local machine host ip
26-
host_ip: 127.0.0.1
26+
host_ip: 192.168.1.12
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/NajmudheenCT/telemetry
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: "{{ telemetry_work_dir }}/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={{ telemetry_work_dir }}/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 {{ telemetry_work_dir }}/volumegroups/{{ opensds_volume_group_nvme }}
91+
sudo mount {{ lvm_nvme_device }} {{ telemetry_work_dir }}/volumegroups/{{ opensds_volume_group_nvme }}
92+
local backing_file={{ telemetry_work_dir }}/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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
ps aux | grep osdsdock | grep -v grep && break
9393
done
9494
args:
95-
chdir: "{{ hotpot_work_dir }}"
95+
chdir: "{{ telemetry_work_dir }}"
9696
when:
9797
- install_from != "container"
9898

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

Lines changed: 44 additions & 0 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:
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 }}"

ansible/roles/telemetry-installer/tasks/main.yml

Lines changed: 190 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,194 @@
1313
# limitations under the License.
1414

1515
---
16-
- name: include scenarios/install_telemetry_tools.yml
17-
tags:
18-
- telemetry
16+
- name: set script dir permissions
17+
file:
18+
path: ./script
19+
mode: 0755
20+
recurse: yes
21+
become: yes
22+
23+
- name: check ansible version
24+
shell: "{{ item }}"
25+
with_items:
26+
- bash ./script/check_ansible_version.sh
27+
become: yes
28+
29+
- name: run the equivalent of "apt-get update" as a separate step
30+
apt:
31+
update_cache: yes
32+
33+
- name: install system packages
34+
package:
35+
name: "{{ item }}"
36+
state: present
37+
with_items:
38+
- make
39+
- gcc
40+
- python-pip
41+
- open-iscsi
42+
43+
- name: install requests package with pip
44+
pip:
45+
name: requests
46+
47+
- name: install Ubuntu system packages
48+
package:
49+
name: "{{ item }}"
50+
state: present
51+
with_items:
52+
- librados-dev
53+
- librbd-dev
54+
when: ansible_os_family == "Debian" and deploy_project == "telemetry"
55+
56+
- name: create telemetry work directory if it doesn't exist
57+
file:
58+
path: "{{ item }}"
59+
state: directory
60+
mode: 0755
61+
with_items:
62+
- "{{ telemetry_work_dir }}"
63+
- "{{ opensds_config_dir }}"
64+
- "{{ opensds_driver_config_dir }}"
65+
- "{{ opensds_log_dir }}"
66+
when: deploy_project == "telemetry"
67+
68+
- name: copy config templates into opensds global config folder
69+
copy:
70+
src: ../../../../conf/
71+
dest: "{{ opensds_config_dir }}"
72+
when: deploy_project == "telemetry"
73+
74+
- name: generate certificates
75+
shell: "{{ item }}"
76+
with_items:
77+
- bash ./script/create_cert.sh "{{ opensds_certs_dir }}"
78+
become: yes
79+
80+
- name: hotpot keystone configuration when keystone is installed by docker
81+
shell: "{{ item }}"
82+
with_items:
83+
- bash ./script/keystone.sh config hotpot docker
84+
when: opensds_auth_strategy == "keystone" and install_keystone_with_docker == true
85+
become: yes
86+
87+
- name: configure openapi specification
88+
copy:
89+
src: "/opt/opensds-hotpot-linux-amd64/swagger.yaml"
90+
dest: "{{ opensds_config_dir }}"
91+
become: yes
92+
ignore_errors: true
93+
94+
# ---------update opensds config file with opensds global info---------
95+
- name: configure opensds global info osdslet
96+
ini_file:
97+
path: "{{ opensds_conf_file }}"
98+
section: osdslet
99+
option: "{{ item.option }}"
100+
value: "{{ item.value }}"
101+
with_items:
102+
- { option: api_endpoint, value: "{{ controller_endpoint }}" }
103+
- { option: log_file, value: "{{ controller_log_file }}" }
104+
become: yes
105+
106+
- name: configure opensds global info osdsapiserver
107+
ini_file:
108+
create: no
109+
path: "{{ opensds_conf_file }}"
110+
section: osdsapiserver
111+
option: "{{ item.option }}"
112+
value: "{{ item.value }}"
113+
with_items:
114+
- { option: api_endpoint, value: "{{ apiserver_endpoint }}" }
115+
- { option: log_file, value: "{{ apiserver_log_file }}" }
116+
- { option: auth_strategy, value: "{{ opensds_auth_strategy }}" }
117+
- { option: https_enabled, value: False }
118+
- { option: beego_https_cert_file, value: "" }
119+
- { option: beego_https_key_file, value: "" }
120+
become: yes
121+
122+
- name: configure opensds global info database
123+
ini_file:
124+
create: no
125+
path: "{{ opensds_conf_file }}"
126+
section: database
127+
option: "{{ item.option }}"
128+
value: "{{ item.value }}"
129+
with_items:
130+
- { option: endpoint, value: "{{ db_endpoint }}" }
131+
- { option: driver, value: "{{ db_driver }}" }
132+
become: yes
133+
134+
# ---------update opensds config file with telemtetry configs---------
135+
- name: Set opensds.conf with telemetry options in osdsapiserver
136+
ini_file:
137+
create: no
138+
path: "{{ opensds_conf_file }}"
139+
section: osdsapiserver
140+
option: "{{ item.option }}"
141+
value: "{{ item.value }}"
142+
with_items:
143+
- { option: prometheus_conf_home, value: "{{ prometheus_conf_home }}" }
144+
- { option: prometheus_url, value: "{{ prometheus_url }}" }
145+
- { option: prometheus_conf_file, value: "{{ prometheus_conf_file }}" }
146+
- { option: alertmgr_conf_home, value: "{{ alertmgr_conf_home }}" }
147+
- { option: alertmgr_url, value: "{{ alertmgr_url }}" }
148+
- { option: alertmgr_conf_file, value: "{{ alertmgr_conf_file }}" }
149+
- { option: grafana_conf_home, value: "{{ grafana_conf_home }}" }
150+
- { option: grafana_restart_cmd, value: "{{ grafana_restart_cmd }}" }
151+
- { option: grafana_conf_file, value: "{{ grafana_conf_file }}" }
152+
- { option: grafana_url, value: "{{ grafana_url }}" }
153+
- { option: conf_reload_url, value: "{{ conf_reload_url }}" }
154+
become: yes
155+
tags: telemetry_conf
156+
157+
- name: Set opensds.conf with telemetry options in osdslet
158+
ini_file:
159+
create: no
160+
path: "{{ opensds_conf_file }}"
161+
section: osdslet
162+
option: "{{ item.option }}"
163+
value: "{{ item.value }}"
164+
with_items:
165+
- { option: prometheus_push_mechanism, value: "{{ prometheus_push_mechanism }}" }
166+
- { option: kafka_endpoint, value: "{{ kafka_endpoint }}" }
167+
- { option: kafka_topic, value: "{{ kafka_topic }}" }
168+
- { option: alertmgr_url, value: "{{ alertmgr_url }}" }
169+
- { option: grafana_url, value: "{{ grafana_url }}" }
170+
become: yes
171+
tags: telemetry_conf
172+
173+
- name: Set push mechanism when NodeExporter is selected
174+
ini_file:
175+
create: no
176+
path: "{{ opensds_conf_file }}"
177+
section: osdslet
178+
option: "{{ item.option }}"
179+
value: "{{ item.value }}"
180+
with_items:
181+
- { option: node_exporter_watch_folder, value: "{{ node_exporter_watch_folder }}" }
182+
become: yes
183+
when: prometheus_push_mechanism == 'NodeExporter'
184+
tags: telemetry_conf
185+
186+
- name: Set push mechanism when PushGateway is selected
187+
ini_file:
188+
create: no
189+
path: "{{ opensds_conf_file }}"
190+
section: osdslet
191+
option: "{{ item.option }}"
192+
value: "{{ item.value }}"
193+
with_items:
194+
- { option: prometheus_push_gateway_url, value: "{{ prometheus_push_gateway_url }}" }
195+
become: yes
196+
when: prometheus_push_mechanism == 'PushGateway'
197+
tags: telemetry_conf
198+
199+
- name: include scenarios/repository.yml when installing from repository
19200
include: scenarios/install_telemetry_tools.yml
201+
when: install_from == "repository" and deploy_project == "telemetry"
202+
203+
- name: include scenarios/source-code.yml when not installing from container
204+
include: scenarios/source-code.yml
205+
when: install_from != "container"
206+

ansible/script/check_ceph_exist.sh

100644100755
File mode changed.

ansible/script/check_ceph_version.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)