2018-05-23 11:07:38 +08:00
|
|
|
---
|
2020-09-26 09:11:03 +08:00
|
|
|
- import_role:
|
|
|
|
name: ceph-facts
|
|
|
|
tasks_from: get_def_crush_rule_name.yml
|
2020-03-27 23:21:09 +08:00
|
|
|
|
2020-09-26 09:11:03 +08:00
|
|
|
- name: create filesystem pools
|
|
|
|
ceph_pool:
|
|
|
|
name: "{{ item.name }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
pg_num: "{{ item.pg_num | default(osd_pool_default_pg_num) if not item.0.pg_autoscale_mode | default(False) | bool else 16 }}"
|
|
|
|
pgp_num: "{{ item.pgp_num | default(item.pg_num) | default(osd_pool_default_pg_num) if not item.pg_autoscale_mode | default(False) | bool else omit }}"
|
|
|
|
size: "{{ item.size | default(omit) }}"
|
|
|
|
min_size: "{{ item.min_size | default(omit) }}"
|
|
|
|
pool_type: "{{ item.type | default('replicated') }}"
|
|
|
|
rule_name: "{{ item.rule_name | default(omit) }}"
|
|
|
|
erasure_profile: "{{ item.erasure_profile | default(omit) }}"
|
|
|
|
pg_autoscale_mode: "{{ item.pg_autoscale_mode | default(omit) }}"
|
|
|
|
target_size_ratio: "{{ item.target_size_ratio | default(omit) }}"
|
|
|
|
with_items: "{{ cephfs_pools }}"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
environment:
|
2020-09-26 00:15:02 +08:00
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
2020-09-26 09:11:03 +08:00
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2018-05-23 11:07:38 +08:00
|
|
|
|
2019-04-24 17:08:15 +08:00
|
|
|
- name: check and create ceph filesystem
|
2018-06-29 17:48:01 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2019-04-24 17:08:15 +08:00
|
|
|
block:
|
|
|
|
- name: check if ceph filesystem already exists
|
2020-04-10 07:02:06 +08:00
|
|
|
command: "{{ ceph_run_cmd }} --cluster {{ cluster }} fs get {{ cephfs }}"
|
2019-04-24 17:08:15 +08:00
|
|
|
register: check_existing_cephfs
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- name: create ceph filesystem
|
2020-04-10 07:02:06 +08:00
|
|
|
command: "{{ ceph_run_cmd }} --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata_pool.name }} {{ cephfs_data_pool.name }}"
|
2019-04-24 17:08:15 +08:00
|
|
|
changed_when: false
|
|
|
|
when: check_existing_cephfs.rc != 0
|
2018-06-29 17:48:01 +08:00
|
|
|
|
2018-05-23 11:07:38 +08:00
|
|
|
- name: set max_mds
|
2020-04-10 07:02:06 +08:00
|
|
|
command: "{{ ceph_run_cmd }} --cluster {{ cluster }} fs set {{ cephfs }} max_mds {{ mds_max_mds }}"
|
2018-05-23 11:07:38 +08:00
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2019-10-11 01:09:49 +08:00
|
|
|
when:
|
|
|
|
- mds_max_mds > 1
|
2020-09-26 00:15:02 +08:00
|
|
|
- not rolling_update | bool
|