+# 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
- name: ceph-common\r
- when: enabled_backend == "ceph"\r
+ name: "{{ item }}"\r
+ state: present\r
+ with_items:\r
+ - ceph-common\r
+\r
+- name: install notario package with pip when ceph backend enabled\r
+ pip:\r
+ name: "{{ item }}"\r
+ with_items:\r
+ - notario\r
+\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
\r
- name: check for ceph-ansible source code existed\r
stat:\r
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\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
+- name: check if ceph osd is running\r
shell: ps aux | grep ceph-osd | grep -v grep\r
- ignore_errors: false\r
+ ignore_errors: true\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
+ ignore_errors: true\r
changed_when: false\r
register: service_ceph_mon_status\r
\r
-- name: Create a pool and initialize it.\r
- shell: ceph osd pool create {{ ceph_pool_name }} 100 && ceph osd pool set {{ ceph_pool_name }} size 1\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
- register: ceph_init_pool\r
- when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0
\ No newline at end of file
+ with_items: "{{ ceph_pools }}"\r
+ when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0\r