Push zealand version of opensds ansible as base-code of Stor4NFV
[stor4nfv.git] / ci / ansible / roles / osdsdock / scenarios / ceph.yml
diff --git a/ci/ansible/roles/osdsdock/scenarios/ceph.yml b/ci/ansible/roles/osdsdock/scenarios/ceph.yml
new file mode 100644 (file)
index 0000000..2f6348e
--- /dev/null
@@ -0,0 +1,69 @@
+---\r
+- name: install ceph-common external package when ceph backend enabled\r
+  apt:\r
+    name: ceph-common\r
+  when: enabled_backend == "ceph"\r
+\r
+- name: check for ceph-ansible source code existed\r
+  stat:\r
+    path: /tmp/ceph-ansible\r
+  ignore_errors: yes\r
+  register: cephansibleexisted\r
+\r
+- name: download ceph-ansible source code\r
+  git:\r
+    repo: https://github.com/ceph/ceph-ansible.git\r
+    dest: /tmp/ceph-ansible\r
+  when:\r
+    - cephansibleexisted.stat.exists is undefined or cephansibleexisted.stat.exists == false\r
+\r
+- name: copy ceph inventory host into ceph-ansible directory\r
+  copy:\r
+    src: ../../../group_vars/ceph/ceph.hosts\r
+    dest: /tmp/ceph-ansible/ceph.hosts\r
+\r
+- name: copy ceph all.yml file into ceph-ansible group_vars directory\r
+  copy:\r
+    src: ../../../group_vars/ceph/all.yml\r
+    dest: /tmp/ceph-ansible/group_vars/all.yml\r
+\r
+- name: copy ceph osds.yml file into ceph-ansible group_vars directory\r
+  copy:\r
+    src: ../../../group_vars/ceph/osds.yml\r
+    dest: /tmp/ceph-ansible/group_vars/osds.yml\r
+\r
+- name: copy site.yml.sample to site.yml in ceph-ansible\r
+  copy:\r
+    src: /tmp/ceph-ansible/site.yml.sample\r
+    dest: /tmp/ceph-ansible/site.yml\r
+\r
+- name: ping all hosts\r
+  shell: ansible all -m ping -i ceph.hosts\r
+  become: true\r
+  args:\r
+    chdir: /tmp/ceph-ansible\r
+\r
+- name: run ceph-ansible playbook\r
+  shell: ansible-playbook site.yml -i ceph.hosts\r
+  become: true\r
+  args:\r
+    chdir: /tmp/ceph-ansible\r
+\r
+- name: Check if ceph osd is running\r
+  shell: ps aux | grep ceph-osd | grep -v grep\r
+  ignore_errors: false\r
+  changed_when: false\r
+  register: service_ceph_osd_status\r
+\r
+- name: Check if ceph mon is running\r
+  shell: ps aux | grep ceph-mon | grep -v grep\r
+  ignore_errors: false\r
+  changed_when: false\r
+  register: service_ceph_mon_status\r
+\r
+- name: Create a pool and initialize it.\r
+  shell: ceph osd pool create {{ ceph_pool_name }} 100 && ceph osd pool set {{ ceph_pool_name }} size 1\r
+  ignore_errors: yes\r
+  changed_when: false\r
+  register: ceph_init_pool\r
+  when: service_ceph_mon_status.rc == 0 and service_ceph_osd_status.rc == 0
\ No newline at end of file