2018-05-23 11:07:38 +08:00
|
|
|
---
|
2018-10-01 23:11:13 +08:00
|
|
|
- name: filesystem pools related tasks
|
|
|
|
block:
|
|
|
|
- name: create filesystem pools
|
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs }}"
|
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
with_items:
|
|
|
|
- "{{ cephfs_pools }}"
|
|
|
|
|
|
|
|
- name: customize pool size
|
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool set {{ item.name }} size {{ item.size | default('') }}"
|
|
|
|
with_items: "{{ cephfs_pools | unique }}"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
changed_when: false
|
|
|
|
when: item.size | default ("") != ""
|
2018-05-23 11:07:38 +08:00
|
|
|
|
|
|
|
- name: check if ceph filesystem already exists
|
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} fs get {{ cephfs }}"
|
|
|
|
register: check_existing_cephfs
|
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- name: create ceph filesystem
|
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }}"
|
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when:
|
|
|
|
- check_existing_cephfs.rc != 0
|
|
|
|
|
2018-06-29 17:48:01 +08:00
|
|
|
- name: assign application to cephfs pools
|
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} osd pool application enable {{ item }} {{ cephfs }}"
|
|
|
|
with_items:
|
|
|
|
- "{{ cephfs_data }}"
|
|
|
|
- "{{ cephfs_metadata }}"
|
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when:
|
|
|
|
- check_existing_cephfs.rc != 0
|
|
|
|
|
2018-05-23 11:07:38 +08:00
|
|
|
- name: allow multimds
|
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} fs set {{ cephfs }} allow_multimds true --yes-i-really-mean-it"
|
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when:
|
2018-06-05 03:52:47 +08:00
|
|
|
- ceph_release_num[ceph_release] == ceph_release_num.luminous
|
2018-05-23 11:07:38 +08:00
|
|
|
|
|
|
|
- name: set max_mds
|
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['docker_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} fs set {{ cephfs }} max_mds {{ mds_max_mds }}"
|
|
|
|
changed_when: false
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
when:
|
|
|
|
- mds_max_mds > 1
|