1 # Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.
\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
7 # http://www.apache.org/licenses/LICENSE-2.0
\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
16 - name: check for etcd existed
\r
18 path: "{{ etcd_dir }}/etcd"
\r
20 register: etcdexisted
\r
22 - name: download etcd
\r
24 url={{ etcd_download_url }}
\r
25 dest=/opt/{{ etcd_tarball }}
\r
27 - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false
\r
29 - name: extract the etcd tarball
\r
31 src=/opt/{{ etcd_tarball }}
\r
34 - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false
\r
36 - name: Check if etcd is running
\r
37 shell: ps aux | grep etcd | grep -v grep
\r
39 register: service_etcd_status
\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
45 chdir: "{{ etcd_dir }}"
\r
46 when: service_etcd_status.rc != 0
\r
48 - name: check etcd cluster health
\r
49 shell: ./etcdctl --endpoints http://{{ etcd_host }}:{{ etcd_port }} cluster-health
\r
53 chdir: "{{ etcd_dir }}"
\r