2b6196ce4ffd5baab4fa6f8c858cd0f61f63f97d
[stor4nfv.git] / ci / ansible / roles / osdsdock / scenarios / ceph.yml
1 ---
2 - name: install ceph-common external package when ceph backend enabled
3   apt:
4     name: ceph-common
5   when: enabled_backend == "ceph"
6
7 - name: copy opensds ceph backend file if specify ceph backend
8   copy:
9     src: ../../../group_vars/ceph/ceph.yaml
10     dest: "{{ ceph_config_path }}"
11
12 - name: check for ceph-ansible source code existed
13   stat:
14     path: /opt/ceph-ansible
15   ignore_errors: yes
16   register: cephansibleexisted
17
18 - name: download ceph-ansible source code
19   git:
20     repo: https://github.com/ceph/ceph-ansible.git
21     dest: /opt/ceph-ansible
22   when:
23     - cephansibleexisted.stat.exists is undefined or cephansibleexisted.stat.exists == false
24
25 - name: copy ceph inventory host into ceph-ansible directory
26   copy:
27     src: ../../../group_vars/ceph/ceph.hosts
28     dest: /opt/ceph-ansible/ceph.hosts
29
30 - name: copy ceph all.yml file into ceph-ansible group_vars directory
31   copy:
32     src: ../../../group_vars/ceph/all.yml
33     dest: /opt/ceph-ansible/group_vars/all.yml
34
35 - name: copy ceph osds.yml file into ceph-ansible group_vars directory
36   copy:
37     src: ../../../group_vars/ceph/osds.yml
38     dest: /opt/ceph-ansible/group_vars/osds.yml
39
40 - name: copy site.yml.sample to site.yml in ceph-ansible
41   copy:
42     src: /opt/ceph-ansible/site.yml.sample
43     dest: /opt/ceph-ansible/site.yml
44
45 - name: ping all hosts
46   shell: ansible all -m ping -i ceph.hosts
47   become: true
48   args:
49     chdir: /opt/ceph-ansible
50
51 - name: run ceph-ansible playbook
52   shell: ansible-playbook site.yml -i ceph.hosts | tee /var/log/ceph_ansible.log
53   become: true
54   args:
55     chdir: /opt/ceph-ansible
56
57 #- name: Check if ceph osd is running
58 #  shell: ps aux | grep ceph-osd | grep -v grep
59 #  ignore_errors: false
60 #  changed_when: false
61 #  register: service_ceph_osd_status
62
63 - name: Check if ceph mon is running
64   shell: ps aux | grep ceph-mon | grep -v grep
65   ignore_errors: false
66   changed_when: false
67   register: service_ceph_mon_status
68
69 - name: Create a pool and initialize it.
70   shell: ceph osd pool create {{ ceph_pool_name }} 100 && ceph osd pool set {{ ceph_pool_name }} size 1
71   ignore_errors: yes
72   changed_when: false
73   register: ceph_init_pool
74   when: service_ceph_mon_status.rc == 0 # and service_ceph_osd_status.rc == 0