]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-mon: Check if ceph filesystem exists 1329/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Thu, 23 Feb 2017 15:06:04 +0000 (16:06 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 24 Feb 2017 08:11:52 +0000 (09:11 +0100)
Check if ceph filesystem already exists before creating it.
If the ceph filesystem doesn't exist, execute the task only on one node.

Fix: #1314
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-mon/tasks/create_mds_filesystems.yml

index d9a89ca77f8d5f940322690028b3cf84b397d1e8..6e7b82d9835b62f6de2b17d8ffe8479e747e7c28 100644 (file)
     - cephfs_metadata
   changed_when: false
 
+- name: check if ceph filesystem already exists
+  command: ceph --cluster {{ cluster }} fs get {{ cephfs }}
+  register: check_existing_cephfs
+  changed_when: false
+  failed_when: false
+  when: inventory_hostname == groups.mons|last
+
 - name: create ceph filesystem
   command: ceph --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }}
   changed_when: false
+  when:
+    - inventory_hostname == groups.mons|last
+    - check_existing_cephfs.rc != 0
 
 - name: allow multimds
   command: ceph --cluster {{ cluster }} fs set {{ cephfs }} allow_multimds true --yes-i-really-mean-it
   changed_when: false
   when:
-  - ceph_release_num.{{ ceph_release }} >= ceph_release_num.jewel
-  - mds_allow_multimds
+    - ceph_release_num.{{ ceph_release }} >= ceph_release_num.jewel
+    - mds_allow_multimds
 
 - name: set max_mds
   command: ceph --cluster {{ cluster }} fs set {{ cephfs }} max_mds {{ mds_max_mds }}
   changed_when: false
   when:
-  - ceph_release_num.{{ ceph_release }} >= ceph_release_num.jewel
-  - mds_allow_multimds
-  - mds_max_mds > 1
+    - ceph_release_num.{{ ceph_release }} >= ceph_release_num.jewel
+    - mds_allow_multimds
+    - mds_max_mds > 1