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