Update stor4nfv install scripts according to opensds aruba release
[stor4nfv.git] / ci / ansible / roles / osdsdock / scenarios / ceph.yml
index b844a29..f5ea8ef 100644 (file)
@@ -1,3 +1,17 @@
+# Copyright (c) 2018 Huawei Technologies Co., Ltd. All Rights Reserved.\r
+#\r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+#\r
+#     http://www.apache.org/licenses/LICENSE-2.0\r
+#\r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+\r
 ---\r
 - name: install ceph-common external package when ceph backend enabled\r
   apt:\r
@@ -5,9 +19,21 @@
     state: present\r
   with_items:\r
     - ceph-common\r
-  when: enabled_backend == "ceph"\r
 \r
-- name: copy opensds ceph backend file if specify ceph backend\r
+- name: configure ceph section in opensds global info if specify ceph backend\r
+  shell: |\r
+    cat >> opensds.conf <<OPENSDS_GLOABL_CONFIG_DOC\r
+\r
+    [ceph]\r
+    name = {{ ceph_name }}\r
+    description = {{ ceph_description }}\r
+    driver_name = {{ ceph_driver_name }}\r
+    config_path = {{ ceph_config_path }}\r
+  args:\r
+    chdir: "{{ opensds_config_dir }}"\r
+  ignore_errors: yes\r
+\r
+- name: copy opensds ceph backend file to ceph config file if specify ceph backend\r
   copy:\r
     src: ../../../group_vars/ceph/ceph.yaml\r
     dest: "{{ ceph_config_path }}"\r
@@ -22,6 +48,7 @@
   git:\r
     repo: https://github.com/ceph/ceph-ansible.git\r
     dest: /opt/ceph-ansible\r
+    version: stable-3.0\r
   when:\r
     - cephansibleexisted.stat.exists is undefined or cephansibleexisted.stat.exists == false\r
 \r
     src: ../../../group_vars/ceph/all.yml\r
     dest: /opt/ceph-ansible/group_vars/all.yml\r
 \r
-- name: copy ceph osds.yml file into ceph-ansible group_vars directory\r
-  copy:\r
-    src: ../../../group_vars/ceph/osds.yml\r
-    dest: /opt/ceph-ansible/group_vars/osds.yml\r
-\r
 - name: copy site.yml.sample to site.yml in ceph-ansible\r
   copy:\r
     src: /opt/ceph-ansible/site.yml.sample\r
     dest: /opt/ceph-ansible/site.yml\r
 \r
-- name: ping all hosts\r
-  shell: ansible all -m ping -i ceph.hosts\r
-  become: true\r
-  args:\r
-    chdir: /opt/ceph-ansible\r
-\r
-- name: run ceph-ansible playbook\r
-  shell: ansible-playbook site.yml -i ceph.hosts | tee /var/log/ceph_ansible.log\r
+- name: ping all hosts and run ceph-ansible playbook\r
+  shell: "{{ item }}"\r
   become: true\r
+  with_items:\r
+    - ansible all -m ping -i ceph.hosts\r
+    - ansible-playbook site.yml -i ceph.hosts | tee /var/log/ceph_ansible.log\r
   args:\r
     chdir: /opt/ceph-ansible\r
 \r
-#- name: Check if ceph osd is running\r
-#  shell: ps aux | grep ceph-osd | grep -v grep\r
-#  ignore_errors: false\r
-#  changed_when: false\r
-#  register: service_ceph_osd_status\r
+- name: check if ceph osd is running\r
+  shell: ps aux | grep ceph-osd | grep -v grep\r
+  ignore_errors: false\r
+  changed_when: false\r
+  register: service_ceph_osd_status\r
 \r
-- name: Check if ceph mon is running\r
+- name: check if ceph mon is running\r
   shell: ps aux | grep ceph-mon | grep -v grep\r
   ignore_errors: false\r
   changed_when: false\r
   register: service_ceph_mon_status\r
 \r
-- name: Create specified pools and initialize them with default pool size.\r
+- name: configure profile and disable some features in ceph for kernel compatible.\r
+  shell: "{{ item }}"\r
+  become: true\r
+  ignore_errors: yes\r
+  with_items:\r
+    - ceph osd crush tunables hammer\r
+    - grep -q "^rbd default features" /etc/ceph/ceph.conf || sed -i '/\[global\]/arbd default features = 1' /etc/ceph/ceph.conf\r
+  when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0\r
+\r
+- name: create specified pools and initialize them with default pool size.\r
   shell: ceph osd pool create {{ item }} 100 && ceph osd pool set {{ item }} size 1\r
   ignore_errors: yes\r
   changed_when: false\r
   with_items: "{{ ceph_pools }}"\r
-  when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0\r
+  when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0\r