From 87ae5a12e909bfeb3bbaa668332568a30b869933 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Fri, 8 Jul 2022 09:33:28 -0400 Subject: [PATCH] Add Ceph support for single-node clusters Ensures that the pool default size/min size is set to something reasonable for a single node (effective RAID-1) and replace teh default CRUSH replicate_rule set for this situation with one choosing OSD instead of host as the default. --- roles/pvc/tasks/ceph/bootstrap.yml | 10 ++++++++++ roles/pvc/tasks/ceph/main.yml | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/roles/pvc/tasks/ceph/bootstrap.yml b/roles/pvc/tasks/ceph/bootstrap.yml index 9bc182c..0422db6 100644 --- a/roles/pvc/tasks/ceph/bootstrap.yml +++ b/roles/pvc/tasks/ceph/bootstrap.yml @@ -80,6 +80,16 @@ - "bluestore cache autotune = true" - "rbd default features = 5" +- name: add single-node cluster options + lineinfile: + dest: /tmp/ceph-bootstrap/ceph.conf + line: "{{ item }}" + state: present + with_items: + - "osd pool default size = 2" + - "osd pool default min size = 1" + when: "{{ pvc_nodes | length }} == 1" + - name: add memory limit if requested lineinfile: dest: /tmp/ceph-bootstrap/ceph.conf diff --git a/roles/pvc/tasks/ceph/main.yml b/roles/pvc/tasks/ceph/main.yml index c26045f..78c2532 100644 --- a/roles/pvc/tasks/ceph/main.yml +++ b/roles/pvc/tasks/ceph/main.yml @@ -129,6 +129,15 @@ - ceph-mon@{{ ansible_hostname }} - ceph-mgr@{{ ansible_hostname }} +# Single-node cluster ruleset +- name: remove default CRUSH replicated_rule ruleset + command: ceph osd crush rule rm replicated_rule + when: "{{ pvc_nodes | length }} == 1" + +- name: add single-node CRUSH replicated_rule ruleset + command: ceph osd crush rule create-replicated replicated_rule default osd + when: "{{ pvc_nodes | length }} == 1" + # System OSD CPU shielding activation - block: - name: install packages