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: install ceph-common external package when ceph backend enabled
\r
23 - name: configure ceph section in opensds global info if specify ceph backend
\r
25 cat >> opensds.conf <<OPENSDS_GLOABL_CONFIG_DOC
\r
28 name = {{ ceph_name }}
\r
29 description = {{ ceph_description }}
\r
30 driver_name = {{ ceph_driver_name }}
\r
31 config_path = {{ ceph_config_path }}
\r
33 chdir: "{{ opensds_config_dir }}"
\r
36 - name: copy opensds ceph backend file to ceph config file if specify ceph backend
\r
38 src: ../../../group_vars/ceph/ceph.yaml
\r
39 dest: "{{ ceph_config_path }}"
\r
41 - name: check for ceph-ansible source code existed
\r
43 path: /opt/ceph-ansible
\r
45 register: cephansibleexisted
\r
47 - name: download ceph-ansible source code
\r
49 repo: https://github.com/ceph/ceph-ansible.git
\r
50 dest: /opt/ceph-ansible
\r
53 - cephansibleexisted.stat.exists is undefined or cephansibleexisted.stat.exists == false
\r
55 - name: copy ceph inventory host into ceph-ansible directory
\r
57 src: ../../../group_vars/ceph/ceph.hosts
\r
58 dest: /opt/ceph-ansible/ceph.hosts
\r
60 - name: copy ceph all.yml file into ceph-ansible group_vars directory
\r
62 src: ../../../group_vars/ceph/all.yml
\r
63 dest: /opt/ceph-ansible/group_vars/all.yml
\r
65 - name: copy site.yml.sample to site.yml in ceph-ansible
\r
67 src: /opt/ceph-ansible/site.yml.sample
\r
68 dest: /opt/ceph-ansible/site.yml
\r
70 - name: ping all hosts and run ceph-ansible playbook
\r
74 - ansible all -m ping -i ceph.hosts
\r
75 - ansible-playbook site.yml -i ceph.hosts | tee /var/log/ceph_ansible.log
\r
77 chdir: /opt/ceph-ansible
\r
79 - name: check if ceph osd is running
\r
80 shell: ps aux | grep ceph-osd | grep -v grep
\r
81 ignore_errors: false
\r
83 register: service_ceph_osd_status
\r
85 - name: check if ceph mon is running
\r
86 shell: ps aux | grep ceph-mon | grep -v grep
\r
87 ignore_errors: false
\r
89 register: service_ceph_mon_status
\r
91 - name: configure profile and disable some features in ceph for kernel compatible.
\r
96 - ceph osd crush tunables hammer
\r
97 - grep -q "^rbd default features" /etc/ceph/ceph.conf || sed -i '/\[global\]/arbd default features = 1' /etc/ceph/ceph.conf
\r
98 when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0
\r
100 - name: create specified pools and initialize them with default pool size.
\r
101 shell: ceph osd pool create {{ item }} 100 && ceph osd pool set {{ item }} size 1
\r
103 changed_when: false
\r
104 with_items: "{{ ceph_pools }}"
\r
105 when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0
\r