summaryrefslogtreecommitdiffstats
path: root/ci/ansible/roles/osdsdb
diff options
context:
space:
mode:
Diffstat (limited to 'ci/ansible/roles/osdsdb')
-rw-r--r--ci/ansible/roles/osdsdb/scenarios/container.yml24
-rw-r--r--ci/ansible/roles/osdsdb/scenarios/etcd.yml25
-rw-r--r--ci/ansible/roles/osdsdb/scenarios/etcd_aarch64.yml39
-rw-r--r--ci/ansible/roles/osdsdb/tasks/main.yml25
4 files changed, 106 insertions, 7 deletions
diff --git a/ci/ansible/roles/osdsdb/scenarios/container.yml b/ci/ansible/roles/osdsdb/scenarios/container.yml
new file mode 100644
index 0000000..0c7664c
--- /dev/null
+++ b/ci/ansible/roles/osdsdb/scenarios/container.yml
@@ -0,0 +1,24 @@
+# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+---
+- name: run etcd containerized service
+ docker_container:
+ name: myetcd
+ image: "{{ etcd_docker_image }}"
+ command: /usr/local/bin/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 }}
+ state: started
+ network_mode: host
+ volumes:
+ - "/usr/share/ca-certificates/:/etc/ssl/certs"
diff --git a/ci/ansible/roles/osdsdb/scenarios/etcd.yml b/ci/ansible/roles/osdsdb/scenarios/etcd.yml
index 79dc444..acd4937 100644
--- a/ci/ansible/roles/osdsdb/scenarios/etcd.yml
+++ b/ci/ansible/roles/osdsdb/scenarios/etcd.yml
@@ -1,3 +1,17 @@
+# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
---
- name: check for etcd existed
stat:
@@ -8,14 +22,14 @@
- name: download etcd
get_url:
url={{ etcd_download_url }}
- dest=/tmp/{{ etcd_tarball }}
+ dest=/opt/{{ etcd_tarball }}
when:
- etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false
- name: extract the etcd tarball
unarchive:
- src=/tmp/{{ etcd_tarball }}
- dest=/tmp/
+ src=/opt/{{ etcd_tarball }}
+ dest=/opt/
when:
- etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false
@@ -25,14 +39,15 @@
register: service_etcd_status
- name: run etcd daemon service
- shell: nohup ./etcd &>>etcd.log &
+ 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 &
become: true
args:
chdir: "{{ etcd_dir }}"
when: service_etcd_status.rc != 0
- name: check etcd cluster health
- shell: ./etcdctl cluster-health
+ shell: ./etcdctl --endpoints http://{{ etcd_host }}:{{ etcd_port }} cluster-health
become: true
+ ignore_errors: true
args:
chdir: "{{ etcd_dir }}"
diff --git a/ci/ansible/roles/osdsdb/scenarios/etcd_aarch64.yml b/ci/ansible/roles/osdsdb/scenarios/etcd_aarch64.yml
new file mode 100644
index 0000000..f3600d8
--- /dev/null
+++ b/ci/ansible/roles/osdsdb/scenarios/etcd_aarch64.yml
@@ -0,0 +1,39 @@
+---
+- name: check for etcd existed
+ stat:
+ path: "{{ etcd_dir }}/etcd"
+ ignore_errors: yes
+ register: etcdexisted
+
+- name: download etcd
+ get_url:
+ url={{ etcd_download_url }}
+ dest=/opt/{{ etcd_tarball }}
+ when:
+ - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false
+
+- name: extract the etcd tarball
+ unarchive:
+ src=/opt/{{ etcd_tarball }}
+ dest=/opt/
+ when:
+ - etcdexisted.stat.exists is undefined or etcdexisted.stat.exists == false
+
+- name: Check if etcd is running
+ shell: ps aux | grep etcd | grep -v grep
+ ignore_errors: true
+ register: service_etcd_status
+
+- name: run etcd daemon service
+ shell: ETCD_UNSUPPORTED_ARCH=arm64 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 &
+ become: true
+ args:
+ chdir: "{{ etcd_dir }}"
+ when: service_etcd_status.rc != 0
+
+- name: check etcd cluster health
+ shell: ./etcdctl --endpoints http://{{ etcd_host }}:{{ etcd_port }} cluster-health
+ become: true
+ ignore_errors: true
+ args:
+ chdir: "{{ etcd_dir }}"
diff --git a/ci/ansible/roles/osdsdb/tasks/main.yml b/ci/ansible/roles/osdsdb/tasks/main.yml
index 41cbd09..f8fa944 100644
--- a/ci/ansible/roles/osdsdb/tasks/main.yml
+++ b/ci/ansible/roles/osdsdb/tasks/main.yml
@@ -1,4 +1,25 @@
+# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
---
- name: include scenarios/etcd.yml
- include: scenarios/etcd.yml
- when: db_driver == "etcd" \ No newline at end of file
+ include: "{{ item }}"
+ with_first_found:
+ - "scenarios/etcd_{{ ansible_architecture }}.yml"
+ - "scenarios/etcd.yml"
+ when: db_driver == "etcd" and etcd_container_enabled == false
+
+- name: include scenarios/container.yml
+ include: scenarios/container.yml
+ when: db_driver == "etcd" and etcd_container_enabled == true