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