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 :
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 :
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 :
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 :
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 :
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 }}"
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 }}"
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 :
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 }}"
371419 with_items :
372420 - systemctl start grafana-server
373421 - systemctl status grafana-server
374- become : yes
422+ become : yes
0 commit comments