# each pool.
# - If a pool's type is 'ec', k and m values must be set via
# the ec_k, and ec_m variables.
+# - The rule_name key can be used with a specific crush rule value (must exist).
+# If the key doesn't exist it falls back to the default replicated_rule.
+# This only works for replicated pool type not erasure.
#rgw_create_pools:
# "{{ rgw_zone }}.rgw.buckets.data":
# pg_num: 8
# size: 3
# type: replicated
+# rule_name: foo
##########
# each pool.
# - If a pool's type is 'ec', k and m values must be set via
# the ec_k, and ec_m variables.
+# - The rule_name key can be used with a specific crush rule value (must exist).
+# If the key doesn't exist it falls back to the default replicated_rule.
+# This only works for replicated pool type not erasure.
#rgw_create_pools:
# "{{ rgw_zone }}.rgw.buckets.data":
# pg_num: 8
# size: 3
# type: replicated
+# rule_name: foo
##########
- item.value.type == 'ec'
- name: create replicated pools for rgw
- command: "{{ container_exec_cmd }} ceph --connect-timeout 10 --cluster {{ cluster }} osd pool create {{ item.key }} {{ item.value.pg_num | default(osd_pool_default_pg_num) }} replicated"
+ command: "{{ container_exec_cmd }} ceph --connect-timeout 10 --cluster {{ cluster }} osd pool create {{ item.key }} {{ item.value.pg_num | default(osd_pool_default_pg_num) }} replicated {{ item.value.rule_name | default(ceph_osd_pool_default_crush_rule_name) }}"
changed_when: false
register: result
retries: 60
- item.value.type is not defined or item.value.type == 'replicated'
- item.value.size | default(osd_pool_default_size) != ceph_osd_pool_default_size
+- name: customize replicated pool crush_rule
+ command: "{{ container_exec_cmd }} ceph --connect-timeout 10 --cluster {{ cluster }} osd pool set {{ item.key }} crush_rule {{ item.value.rule_name | default(ceph_osd_pool_default_crush_rule_name) }}"
+ register: result
+ retries: 60
+ delay: 3
+ until: result is succeeded
+ loop: "{{ rgw_create_pools | dict2items }}"
+ delegate_to: "{{ groups[mon_group_name][0] }}"
+ changed_when: false
+ when:
+ - item.value.type is not defined or item.value.type == 'replicated'
+ - item.value.rule_name | default(ceph_osd_pool_default_crush_rule_name)
+
- name: set the rgw_create_pools pools application to rgw
command: "{{ container_exec_cmd }} ceph --connect-timeout 10 --cluster {{ cluster }} osd pool application enable {{ item.key }} rgw"
register: result