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: install notario package with pip when ceph backend enabled
\r
29 - name: configure ceph section in opensds global info if specify ceph backend
\r
31 cat >> opensds.conf <<OPENSDS_GLOABL_CONFIG_DOC
\r
34 name = {{ ceph_name }}
\r
35 description = {{ ceph_description }}
\r
36 driver_name = {{ ceph_driver_name }}
\r
37 config_path = {{ ceph_config_path }}
\r
39 chdir: "{{ opensds_config_dir }}"
\r
42 - name: copy opensds ceph backend file to ceph config file if specify ceph backend
\r
44 src: ../../../group_vars/ceph/ceph.yaml
\r
45 dest: "{{ ceph_config_path }}"
\r
47 - name: check for ceph-ansible source code existed
\r
49 path: /opt/ceph-ansible
\r
51 register: cephansibleexisted
\r
53 - name: download ceph-ansible source code
\r
55 repo: https://github.com/ceph/ceph-ansible.git
\r
56 dest: /opt/ceph-ansible
\r
59 - cephansibleexisted.stat.exists is undefined or cephansibleexisted.stat.exists == false
\r
61 - name: copy ceph inventory host into ceph-ansible directory
\r
63 src: ../../../group_vars/ceph/ceph.hosts
\r
64 dest: /opt/ceph-ansible/ceph.hosts
\r
66 - name: copy ceph all.yml file into ceph-ansible group_vars directory
\r
68 src: ../../../group_vars/ceph/all.yml
\r
69 dest: /opt/ceph-ansible/group_vars/all.yml
\r
71 - name: copy site.yml.sample to site.yml in ceph-ansible
\r
73 src: /opt/ceph-ansible/site.yml.sample
\r
74 dest: /opt/ceph-ansible/site.yml
\r
76 - name: ping all hosts and run ceph-ansible playbook
\r
80 - ansible all -m ping -i ceph.hosts
\r
81 - ansible-playbook site.yml -i ceph.hosts | tee /var/log/ceph_ansible.log
\r
83 chdir: /opt/ceph-ansible
\r
85 - name: check if ceph osd is running
\r
86 shell: ps aux | grep ceph-osd | grep -v grep
\r
89 register: service_ceph_osd_status
\r
91 - name: check if ceph mon is running
\r
92 shell: ps aux | grep ceph-mon | grep -v grep
\r
95 register: service_ceph_mon_status
\r
97 - name: configure profile and disable some features in ceph for kernel compatible.
\r
102 - ceph osd crush tunables hammer
\r
103 - grep -q "^rbd default features" /etc/ceph/ceph.conf || sed -i '/\[global\]/arbd default features = 1' /etc/ceph/ceph.conf
\r
104 when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0
\r
106 - name: create specified pools and initialize them with default pool size.
\r
107 shell: ceph osd pool create {{ item }} 100 && ceph osd pool set {{ item }} size 1
\r
109 changed_when: false
\r
110 with_items: "{{ ceph_pools }}"
\r
111 when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0
\r