# - "{{ crush_rule_hdd }}"
# - "{{ crush_rule_ssd }}"
+# Caution: this will create crush roots and racks according to {{ osd_crush_location }}
+# and will move hosts into them which might lead to significant data movement in the cluster!
+#create_crush_tree: false
#############
# OPENSTACK #
- "{{ crush_rule_hdd }}"
- "{{ crush_rule_ssd }}"
+# Caution: this will create crush roots and racks according to {{ osd_crush_location }}
+# and will move hosts into them which might lead to significant data movement in the cluster!
+create_crush_tree: false
#############
# OPENSTACK #
changed_when: false
failed_when: false
run_once: true
+ when: create_crush_tree
+
+- name: create rack type buckets needed for configured crush rules
+ command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd crush add-bucket {{ hostvars[item]['ceph_crush_rack']|default('default_rack_' + hostvars[item]['ceph_crush_root']) }} rack"
+ with_items: "{{ groups[osd_group_name] }}"
+ changed_when: false
+ failed_when: false
+ run_once: true
+ when: create_crush_tree
+
+- name: move rack type buckets to created corresponding crush roots
+ command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd crush move {{ hostvars[item]['ceph_crush_rack']|default('default_rack_' + hostvars[item]['ceph_crush_root']) }} root={{ hostvars[item]['ceph_crush_root'] }}"
+ with_items: "{{ groups[osd_group_name] }}"
+ changed_when: false
+ failed_when: false
+ run_once: true
+ when: create_crush_tree
+
+- name: move host type buckets to rack type ones
+ command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd crush move {{ hostvars[item]['ansible_hostname'] }} rack={{ hostvars[item]['ceph_crush_rack']|default('default_rack_' + hostvars[item]['ceph_crush_root']) }}"
+ with_items: "{{ groups[osd_group_name] }}"
+ changed_when: false
+ failed_when: false
+ run_once: true
+ when: create_crush_tree
- name: create configured crush rules
command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd crush rule create-simple {{ item.name }} {{ item.root }} {{ item.type }}"