Update stor4nfv install scripts according to opensds aruba release
[stor4nfv.git] / ci / ansible / roles / osdsdb / scenarios / etcd.yml
1 # Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.\r
2 #\r
3 # Licensed under the Apache License, Version 2.0 (the "License");\r
4 # you may not use this file except in compliance with the License.\r
5 # You may obtain a copy of the License at\r
6 #\r
7 #     http://www.apache.org/licenses/LICENSE-2.0\r
8 #\r
9 # Unless required by applicable law or agreed to in writing, software\r
10 # distributed under the License is distributed on an "AS IS" BASIS,\r
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
12 # See the License for the specific language governing permissions and\r
13 # limitations under the License.\r
14 \r
15 ---\r
16 - name: check for etcd existed\r
17   stat:\r
18     path: "{{ etcd_dir }}/etcd"\r
19   ignore_errors: yes\r
20   register: etcdexisted\r
21 \r
22 - name: download etcd\r
23   get_url:\r
24     url={{ etcd_download_url }}\r
25     dest=/opt/{{ etcd_tarball }}\r
26   when:\r
27     - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false\r
28 \r
29 - name: extract the etcd tarball\r
30   unarchive:\r
31     src=/opt/{{ etcd_tarball }}\r
32     dest=/opt/\r
33   when:\r
34     - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false\r
35 \r
36 - name: Check if etcd is running\r
37   shell: ps aux | grep etcd | grep -v grep\r
38   ignore_errors: true\r
39   register: service_etcd_status\r
40 \r
41 - name: run etcd daemon service\r
42   shell: nohup ./etcd --advertise-client-urls http://{{ etcd_host }}:{{ etcd_port }} --listen-client-urls http://{{ etcd_host }}:{{ etcd_port }}  --listen-peer-urls http://{{ etcd_host }}:{{ etcd_peer_port }} &>>etcd.log &\r
43   become: true\r
44   args:\r
45     chdir: "{{ etcd_dir }}"\r
46   when: service_etcd_status.rc != 0\r
47 \r
48 - name: check etcd cluster health\r
49   shell: ./etcdctl --endpoints http://{{ etcd_host }}:{{ etcd_port }} cluster-health\r
50   become: true\r
51   ignore_errors: true\r
52   args:\r
53     chdir: "{{ etcd_dir }}"\r