From 82c9abb72557b0a7f282e4939bfe06191431ae8f Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Han?= Date: Wed, 11 Mar 2015 22:50:38 -0500 Subject: [PATCH] Fix MDS creation for version >= 0.84 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The ceph fs new command was introduced in Ceph 0.84. Prior to this release, no manual steps are required to create a filesystem, and pools named data and metadata exist by default. Signed-off-by: Sébastien Han --- roles/ceph-mon/defaults/main.yml | 5 +++++ roles/ceph-mon/tasks/create_mds_filesystems.yml | 9 +++++++++ roles/ceph-mon/tasks/deploy_monitors.yml | 4 ++++ roles/ceph-mon/tasks/main.yml | 4 ++-- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 roles/ceph-mon/tasks/create_mds_filesystems.yml diff --git a/roles/ceph-mon/defaults/main.yml b/roles/ceph-mon/defaults/main.yml index 74728971d..2240dab77 100644 --- a/roles/ceph-mon/defaults/main.yml +++ b/roles/ceph-mon/defaults/main.yml @@ -14,6 +14,11 @@ cephx: true # referenced in common role too. radosgw: false +# CephFS +pool_default_pg_num: 128 +cephfs_data: cephfs_data +cephfs_metadata: cephfs_metadata +cephfs: cephfs ############# # OPENSTACK # diff --git a/roles/ceph-mon/tasks/create_mds_filesystems.yml b/roles/ceph-mon/tasks/create_mds_filesystems.yml new file mode 100644 index 000000000..4ebedbc33 --- /dev/null +++ b/roles/ceph-mon/tasks/create_mds_filesystems.yml @@ -0,0 +1,9 @@ +--- +- name: Create filesystem pools + command: ceph osd pool create {{ item }} {{ pool_default_pg_num }} + with_items: + - cephfs_data + - cephfs_metadata + +- name: Create Ceph Filesystem + command: ceph fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }} diff --git a/roles/ceph-mon/tasks/deploy_monitors.yml b/roles/ceph-mon/tasks/deploy_monitors.yml index 59806cc21..3721f16b9 100644 --- a/roles/ceph-mon/tasks/deploy_monitors.yml +++ b/roles/ceph-mon/tasks/deploy_monitors.yml @@ -26,3 +26,7 @@ state=started enabled=yes args=mon + +- name: Get Ceph monitor version + shell: ceph daemon mon."{{ ansible_hostname }}" version | cut -d '"' -f 4 | cut -f 1,2 -d '.' + register: ceph_version diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index 0a7415374..24a470f27 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -5,8 +5,8 @@ - include: ceph_keys.yml when: not ceph_containerized_deployment -- include: ceph_keys.yml - when: not ceph_containerized_deployment +- include: create_mds_filesystems.yml + when: not ceph_containerized_deployment and not {{ ceph_version.stdout | version_compare('0.84', '<') }} - include: docker.yml when: ceph_containerized_deployment -- 2.39.5