]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
mds: precisely define cephfs pool 2036/head
authorSébastien Han <seb@redhat.com>
Thu, 12 Oct 2017 12:55:53 +0000 (14:55 +0200)
committerSébastien Han <seb@redhat.com>
Thu, 12 Oct 2017 13:56:04 +0000 (15:56 +0200)
We now have a variable called ceph_pools that is mandatory when
deploying a MDS.
It's a dictionnary that contains a pool name and a PG count. PG count is
mandatory and must be set, the playbook will fail otherwise.

Closes: https://github.com/ceph/ceph-ansible/issues/2017
Signed-off-by: Sébastien Han <seb@redhat.com>
group_vars/mons.yml.sample
roles/ceph-mon/defaults/main.yml
roles/ceph-mon/tasks/check_mandatory_vars.yml
roles/ceph-mon/tasks/create_mds_filesystems.yml
tests/functional/centos/7/cluster/group_vars/mons [new file with mode: 0644]
tests/functional/centos/7/docker/group_vars/mons [new file with mode: 0644]
tests/functional/ubuntu/16.04/cluster/group_vars/mons [new file with mode: 0644]

index 2f73d2b8262c486fbb9a6ab7dfe168bad29830e7..0c3395e29223e563af31bdb2e10b6b7a6d249084 100644 (file)
@@ -12,18 +12,12 @@ dummy:
 ###########
 # GENERAL #
 ###########
-
 #mon_group_name: mons
 
 # ACTIVATE BOTH FSID AND MONITOR_SECRET VARIABLES FOR NON-VAGRANT DEPLOYMENT
 #monitor_secret: "{{ monitor_keyring.stdout }}"
 #admin_secret: 'admin_secret'
 
-# CephFS
-#cephfs_data: cephfs_data
-#cephfs_metadata: cephfs_metadata
-#cephfs: cephfs
-
 # Secure your cluster
 # This will set the following flags on all the pools:
 # * nosizechange
@@ -43,9 +37,21 @@ dummy:
 #calamari_debug: false
 
 
-#############
-# crush rules
-#############
+##########
+# CEPHFS #
+##########
+#cephfs: cephfs # name of the ceph filesystem
+#cephfs_data: cephfs_data # name of the data pool for a given filesystem
+#cephfs_metadata: cephfs_metadata # name of the metadata pool for a given filesystem
+
+#cephfs_pools:
+#  - { name: "{{ cephfs_data }}", pgs: "" }
+#  - { name: "{{ cephfs_metadata }}", pgs: "" }
+
+
+###############
+# CRUSH RULES #
+###############
 #crush_rule_config: false
 
 #crush_rule_hdd:
@@ -63,10 +69,11 @@ dummy:
 #crush_rules:
 #  - "{{ crush_rule_hdd }}"
 #  - "{{ crush_rule_ssd }}"
+
+
 #############
 # OPENSTACK #
 #############
-
 #openstack_config: false
 #openstack_glance_pool:
 #  name: images
@@ -110,6 +117,7 @@ dummy:
 #  - { name: client.gnocchi, key: "$(ceph-authtool --gen-print-key)", mon_cap: "allow r", osd_cap: "allow class-read object_prefix rbd_children, allow rwx pool={{ openstack_gnocchi_pool.name }}", mode: "0600", acls: [] }
 #  - { name: client.openstack, key: "$(ceph-authtool --gen-print-key)", mon_cap: "allow r", osd_cap: "allow class-read object_prefix rbd_children, allow rwx pool=images, allow rwx pool=vms, allow rwx pool=volumes, allow rwx pool=backups", mode: "0600", acls: [] }
 
+
 ##########
 # DOCKER #
 ##########
index ca3c07d9513796864017d3142447bac606d127a6..c03faa7377900bff12798d60aafe9335a7adc6ec 100644 (file)
@@ -4,18 +4,12 @@
 ###########
 # GENERAL #
 ###########
-
 mon_group_name: mons
 
 # ACTIVATE BOTH FSID AND MONITOR_SECRET VARIABLES FOR NON-VAGRANT DEPLOYMENT
 monitor_secret: "{{ monitor_keyring.stdout }}"
 admin_secret: 'admin_secret'
 
-# CephFS
-cephfs_data: cephfs_data
-cephfs_metadata: cephfs_metadata
-cephfs: cephfs
-
 # Secure your cluster
 # This will set the following flags on all the pools:
 # * nosizechange
@@ -35,9 +29,21 @@ calamari: false
 calamari_debug: false
 
 
-#############
-# crush rules
-#############
+##########
+# CEPHFS #
+##########
+cephfs: cephfs # name of the ceph filesystem
+cephfs_data: cephfs_data # name of the data pool for a given filesystem
+cephfs_metadata: cephfs_metadata # name of the metadata pool for a given filesystem
+
+cephfs_pools:
+  - { name: "{{ cephfs_data }}", pgs: "" }
+  - { name: "{{ cephfs_metadata }}", pgs: "" }
+
+
+###############
+# CRUSH RULES #
+###############
 crush_rule_config: false
 
 crush_rule_hdd:
@@ -55,10 +61,11 @@ crush_rule_ssd:
 crush_rules:
   - "{{ crush_rule_hdd }}"
   - "{{ crush_rule_ssd }}"
+
+
 #############
 # OPENSTACK #
 #############
-
 openstack_config: false
 openstack_glance_pool:
   name: images
@@ -102,6 +109,7 @@ openstack_keys:
   - { name: client.gnocchi, key: "$(ceph-authtool --gen-print-key)", mon_cap: "allow r", osd_cap: "allow class-read object_prefix rbd_children, allow rwx pool={{ openstack_gnocchi_pool.name }}", mode: "0600", acls: [] }
   - { name: client.openstack, key: "$(ceph-authtool --gen-print-key)", mon_cap: "allow r", osd_cap: "allow class-read object_prefix rbd_children, allow rwx pool=images, allow rwx pool=vms, allow rwx pool=volumes, allow rwx pool=backups", mode: "0600", acls: [] }
 
+
 ##########
 # DOCKER #
 ##########
index cb0b950705851b13ab7037cc75f9723c3cafc082..395838242632018439c55cd4241735339582665d 100644 (file)
@@ -6,3 +6,11 @@
     - monitor_interface == 'interface'
     - monitor_address == '0.0.0.0'
     - monitor_address_block | length == 0
+
+- name: make sure pg num is set for cephfs pools
+  fail:
+    msg: "You must set pg num for your cephfs pools, see the cephfs_pools variable."
+  with_items: "{{ cephfs_pools }}"
+  when:
+    - inventory_hostname in groups.get(mds_group_name, [])
+    - item.pgs == ''
index a1292ee494aa8d858f398c4ef547dd79c65559a0..313f188155853f3605936d105ccff418c247a9fa 100644 (file)
@@ -1,14 +1,9 @@
 ---
-# NOTE (leseb): in the present playbook the conditional is done on the task
-# We don't do this in main.yml because of the 'docker' variable, when set to true
-# the role 'ceph-common' doesn't get inherited so the condition can not be evaluate
-# since those check are performed by the ceph-common role
 - name: create filesystem pools
-  command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd pool create {{ item }} {{ osd_pool_default_pg_num }}"
-  with_items:
-    - "{{ cephfs_data }}"
-    - "{{ cephfs_metadata }}"
+  command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs }}"
   changed_when: false
+  with_items:
+    - "{{ cephfs_pools }}"
 
 - name: check if ceph filesystem already exists
   command: "{{docker_exec_cmd }} ceph --cluster {{ cluster }} fs get {{ cephfs }}"
@@ -19,7 +14,8 @@
 - name: create ceph filesystem
   command: "{{ docker_exec_cmd}} ceph --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }}"
   changed_when: false
-  when: check_existing_cephfs.rc != 0
+  when:
+    - check_existing_cephfs.rc != 0
 
 - name: allow multimds
   command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} fs set {{ cephfs }} allow_multimds true --yes-i-really-mean-it"
diff --git a/tests/functional/centos/7/cluster/group_vars/mons b/tests/functional/centos/7/cluster/group_vars/mons
new file mode 100644 (file)
index 0000000..acb0949
--- /dev/null
@@ -0,0 +1,4 @@
+---
+cephfs_pools:
+  - { name: "{{ cephfs_data }}", pgs: "8" }
+  - { name: "{{ cephfs_metadata }}", pgs: "8" }
diff --git a/tests/functional/centos/7/docker/group_vars/mons b/tests/functional/centos/7/docker/group_vars/mons
new file mode 100644 (file)
index 0000000..acb0949
--- /dev/null
@@ -0,0 +1,4 @@
+---
+cephfs_pools:
+  - { name: "{{ cephfs_data }}", pgs: "8" }
+  - { name: "{{ cephfs_metadata }}", pgs: "8" }
diff --git a/tests/functional/ubuntu/16.04/cluster/group_vars/mons b/tests/functional/ubuntu/16.04/cluster/group_vars/mons
new file mode 100644 (file)
index 0000000..acb0949
--- /dev/null
@@ -0,0 +1,4 @@
+---
+cephfs_pools:
+  - { name: "{{ cephfs_data }}", pgs: "8" }
+  - { name: "{{ cephfs_metadata }}", pgs: "8" }