diff --git a/roles/ceph-mds/tasks/create_mds_filesystems.yml b/roles/ceph-mds/tasks/create_mds_filesystems.yml new file mode 100644 index 000000000..9320c1544 --- /dev/null +++ b/roles/ceph-mds/tasks/create_mds_filesystems.yml @@ -0,0 +1,37 @@ +--- +- 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: 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 + +- 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: + - ceph_release_num[ceph_release] >= ceph_release_num.jewel + - ceph_release_num[ceph_release] < ceph_release_num.mimic + +- 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: + - ceph_release_num[ceph_release] >= ceph_release_num.jewel + - mds_max_mds > 1 diff --git a/roles/ceph-mds/tasks/main.yml b/roles/ceph-mds/tasks/main.yml index 18f6f81cf..adf971a10 100644 --- a/roles/ceph-mds/tasks/main.yml +++ b/roles/ceph-mds/tasks/main.yml @@ -8,6 +8,11 @@ - name: include common.yml include: common.yml +- name: include create_mds_filesystems.yml + include: create_mds_filesystems.yml + when: + - inventory_hostname == groups[mds_group_name] | first + - name: non_containerized.yml include: non_containerized.yml when: not containerized_deployment diff --git a/roles/ceph-mon/tasks/create_mds_filesystems.yml b/roles/ceph-mon/tasks/create_mds_filesystems.yml deleted file mode 100644 index 75df0a29b..000000000 --- a/roles/ceph-mon/tasks/create_mds_filesystems.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- name: create filesystem pools - command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} osd pool create {{ item.name }} {{ item.pgs }}" - changed_when: false - with_items: - - "{{ cephfs_pools }}" - -- name: check if ceph filesystem already exists - command: "{{docker_exec_cmd }} ceph --cluster {{ cluster }} fs get {{ cephfs }}" - register: check_existing_cephfs - changed_when: false - failed_when: false - -- name: create ceph filesystem - command: "{{ docker_exec_cmd}} ceph --cluster {{ cluster }} fs new {{ cephfs }} {{ cephfs_metadata }} {{ cephfs_data }}" - changed_when: false - when: - - check_existing_cephfs.rc != 0 - -- name: allow multimds - command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} fs set {{ cephfs }} allow_multimds true --yes-i-really-mean-it" - changed_when: false - when: - - ceph_release_num[ceph_release] >= ceph_release_num.jewel - - ceph_release_num[ceph_release] < ceph_release_num.mimic - -- name: set max_mds - command: "{{ docker_exec_cmd }} ceph --cluster {{ cluster }} fs set {{ cephfs }} max_mds {{ mds_max_mds }}" - changed_when: false - when: - - ceph_release_num[ceph_release] >= ceph_release_num.jewel - - mds_max_mds > 1 diff --git a/roles/ceph-mon/tasks/main.yml b/roles/ceph-mon/tasks/main.yml index ad6b825b4..b3d046257 100644 --- a/roles/ceph-mon/tasks/main.yml +++ b/roles/ceph-mon/tasks/main.yml @@ -50,13 +50,6 @@ when: - openstack_keys_tmp is defined -- name: include create_mds_filesystems.yml - include: create_mds_filesystems.yml - when: - - groups[mds_group_name] is defined - - groups[mds_group_name]|length > 0 - - inventory_hostname == groups[mon_group_name] | last - - name: include calamari.yml include: calamari.yml when: calamari diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index 4adade3b4..baa65a19b 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -92,4 +92,4 @@ include: openstack_config.yml when: - openstack_config - - inventory_hostname == groups[osd_group_name] | last \ No newline at end of file + - inventory_hostname == groups[osd_group_name] | last