Merge nbp installation into opensds ansible script
[stor4nfv.git] / ci / ansible / roles / osdsdock / scenarios / ceph.yml
index 2f6348e..b844a29 100644 (file)
@@ -1,59 +1,67 @@
 ---\r
 - name: install ceph-common external package when ceph backend enabled\r
   apt:\r
-    name: ceph-common\r
+    name: "{{ item }}"\r
+    state: present\r
+  with_items:\r
+    - ceph-common\r
   when: enabled_backend == "ceph"\r
 \r
+- name: copy opensds ceph backend file if specify ceph backend\r
+  copy:\r
+    src: ../../../group_vars/ceph/ceph.yaml\r
+    dest: "{{ ceph_config_path }}"\r
+\r
 - name: check for ceph-ansible source code existed\r
   stat:\r
-    path: /tmp/ceph-ansible\r
+    path: /opt/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
+    dest: /opt/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
+    dest: /opt/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
+    dest: /opt/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
+    dest: /opt/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
+    src: /opt/ceph-ansible/site.yml.sample\r
+    dest: /opt/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
+    chdir: /opt/ceph-ansible\r
 \r
 - name: run ceph-ansible playbook\r
-  shell: ansible-playbook site.yml -i ceph.hosts\r
+  shell: ansible-playbook site.yml -i ceph.hosts | tee /var/log/ceph_ansible.log\r
   become: true\r
   args:\r
-    chdir: /tmp/ceph-ansible\r
+    chdir: /opt/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
+#- 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
@@ -61,9 +69,9 @@
   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
+- name: Create specified pools and initialize them with default pool size.\r
+  shell: ceph osd pool create {{ item }} 100 && ceph osd pool set {{ item }} 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
+  with_items: "{{ ceph_pools }}"\r
+  when: service_ceph_mon_status.rc == 0 # and service_ceph_osd_status.rc == 0\r