ceph-ansible/roles/ceph-rgw/tasks/rgw_create_pools.yml

53 lines
2.4 KiB
YAML

---
- name: Create ec profile
ceph_ec_profile:
name: "{{ item.value.ec_profile }}"
cluster: "{{ cluster }}"
k: "{{ item.value.ec_k | default(omit) }}"
m: "{{ item.value.ec_m | default(omit) }}"
crush_device_class: "{{ item.value.ec_crush_device_class | default(omit) }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
loop: "{{ rgw_create_pools | dict2items }}"
when:
- item.value.create_profile | default(true)
- item.value.type | default('') == 'ec'
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
- name: Set crush rule
ceph_crush_rule:
name: "{{ item.key }}"
cluster: "{{ cluster }}"
rule_type: erasure
profile: "{{ item.value.ec_profile }}"
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
loop: "{{ rgw_create_pools | dict2items }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
when:
- item.value.create_profile | default(true)
- item.value.type | default('') == 'ec'
- name: Create rgw pools
ceph_pool:
name: "{{ item.key }}"
state: present
cluster: "{{ cluster }}"
pg_num: "{{ item.value.pg_num | default(omit) }}"
pgp_num: "{{ item.value.pgp_num | default(omit) }}"
size: "{{ item.value.size | default(omit) }}"
min_size: "{{ item.value.min_size | default(omit) }}"
pg_autoscale_mode: "{{ item.value.pg_autoscale_mode | default(omit) }}"
target_size_ratio: "{{ item.value.target_size_ratio | default(omit) }}"
pool_type: "{{ 'erasure' if item.value.type | default('') == 'ec' else 'replicated' }}"
erasure_profile: "{{ item.value.ec_profile | default(omit) }}"
rule_name: "{{ item.value.rule_name if item.value.rule_name is defined else item.key if item.value.type | default('') == 'ec' else ceph_osd_pool_default_crush_rule_name }}"
application: rgw
loop: "{{ rgw_create_pools | dict2items }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
environment:
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
CEPH_CONTAINER_BINARY: "{{ container_binary }}"