Merge nbp installation into opensds ansible script
[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: "{{ item }}"\r
5     state: present\r
6   with_items:\r
7     - ceph-common\r
8   when: enabled_backend == "ceph"\r
9 \r
10 - name: copy opensds ceph backend file if specify ceph backend\r
11   copy:\r
12     src: ../../../group_vars/ceph/ceph.yaml\r
13     dest: "{{ ceph_config_path }}"\r
14 \r
15 - name: check for ceph-ansible source code existed\r
16   stat:\r
17     path: /opt/ceph-ansible\r
18   ignore_errors: yes\r
19   register: cephansibleexisted\r
20 \r
21 - name: download ceph-ansible source code\r
22   git:\r
23     repo: https://github.com/ceph/ceph-ansible.git\r
24     dest: /opt/ceph-ansible\r
25   when:\r
26     - cephansibleexisted.stat.exists is undefined or cephansibleexisted.stat.exists == false\r
27 \r
28 - name: copy ceph inventory host into ceph-ansible directory\r
29   copy:\r
30     src: ../../../group_vars/ceph/ceph.hosts\r
31     dest: /opt/ceph-ansible/ceph.hosts\r
32 \r
33 - name: copy ceph all.yml file into ceph-ansible group_vars directory\r
34   copy:\r
35     src: ../../../group_vars/ceph/all.yml\r
36     dest: /opt/ceph-ansible/group_vars/all.yml\r
37 \r
38 - name: copy ceph osds.yml file into ceph-ansible group_vars directory\r
39   copy:\r
40     src: ../../../group_vars/ceph/osds.yml\r
41     dest: /opt/ceph-ansible/group_vars/osds.yml\r
42 \r
43 - name: copy site.yml.sample to site.yml in ceph-ansible\r
44   copy:\r
45     src: /opt/ceph-ansible/site.yml.sample\r
46     dest: /opt/ceph-ansible/site.yml\r
47 \r
48 - name: ping all hosts\r
49   shell: ansible all -m ping -i ceph.hosts\r
50   become: true\r
51   args:\r
52     chdir: /opt/ceph-ansible\r
53 \r
54 - name: run ceph-ansible playbook\r
55   shell: ansible-playbook site.yml -i ceph.hosts | tee /var/log/ceph_ansible.log\r
56   become: true\r
57   args:\r
58     chdir: /opt/ceph-ansible\r
59 \r
60 #- name: Check if ceph osd is running\r
61 #  shell: ps aux | grep ceph-osd | grep -v grep\r
62 #  ignore_errors: false\r
63 #  changed_when: false\r
64 #  register: service_ceph_osd_status\r
65 \r
66 - name: Check if ceph mon is running\r
67   shell: ps aux | grep ceph-mon | grep -v grep\r
68   ignore_errors: false\r
69   changed_when: false\r
70   register: service_ceph_mon_status\r
71 \r
72 - name: Create specified pools and initialize them with default pool size.\r
73   shell: ceph osd pool create {{ item }} 100 && ceph osd pool set {{ item }} size 1\r
74   ignore_errors: yes\r
75   changed_when: false\r
76   with_items: "{{ ceph_pools }}"\r
77   when: service_ceph_mon_status.rc == 0 # and service_ceph_osd_status.rc == 0\r