# Get a fresh ceph_cli - name: Get ceph_cli ansible.builtin.include_tasks: ceph_cli.yaml vars: ceph_fsid: "{{ mon_dump.fsid }}" ceph_cluster: ceph - name: MDS - Load Spec from the orchestrator ansible.builtin.set_fact: mds_spec: "{{ mds }}" vars: mds: |- {% set mds = {} %} {% for item in servicemap %} {% if item.service_type == 'mds' %} {% set _ = mds.__setitem__('service_type', item.service_type) %} {% set _ = mds.__setitem__('service_name', item.service_name) %} {% set _ = mds.__setitem__('spec', {}) %} {% endif %} {% endfor %} {{ mds }} - name: Print the resulting MDS spec ansible.builtin.debug: msg: "{{ mds_spec }}" when: debug | default(false) # - Expand labels to the rest of the hosts - name: Expand MDS labels to the overcloud nodes ansible.builtin.import_tasks: labels.yaml vars: nodes: "{{ hostmap.keys() }}" act: "add" labels: - "mds" # - Update and apply the spec: it will deploy standby mds daemons everywhere - name: Update the MDS Daemon spec definition # root privileges required to run cephadm # and apply the new spec become: true ceph_mkspec: service_type: "{% set st = mds_spec.get('service_type', 'mds') %}{{ st }}" cluster: ceph apply: true label: "mds" render_path: "{{ ceph_spec_render_dir }}" register: spc environment: CEPH_CONTAINER_IMAGE: "{{ ceph_container }}" CEPH_CONTAINER_BINARY: "{{ ceph_container_cli }}" - name: Print the resulting spec ansible.builtin.debug: msg: "{{ spc }}" when: debug | default(false) - name: Wait for the orchestrator to process the spec ansible.builtin.pause: seconds: "{{ ceph_timeout }}" - name: Reload MdsMap # cephadm runs w/ root privileges become: true block: - name: Reload the updated mdsmap ansible.builtin.command: "{{ ceph_cli }} fs status cephfs -f json" register: mds - name: Get MDS Daemons ansible.builtin.set_fact: mds_daemons: "{{ mds.stdout | from_json }}" - name: Print Daemons ansible.builtin.debug: msg: "{{ mds_daemons }}" when: debug | default(false) # Load MDS daemons that are not deployed on the nodes that are going to be # decommissioned: this task might be improved and split into multiple tasks # that make a multi-step filtering - name: Set MDS Affinity block: - name: Get MDS daemons that are not part of decomm nodes when: - not item | regex_search('controller') - item.state == "standby" - target_nodes | length > 0 ansible.builtin.set_fact: mds_aff_daemon: "{{ item }}" loop: "{{ mds_daemons.mdsmap }}" - name: Affinity daemon selected ansible.builtin.debug: msg: "{{ mds_aff_daemon | default('') }}" when: debug | default(true) # Set affinity to the detected target node where a standby daemon # has been deployed - name: Set MDS affinity when: mds_aff_daemon | default('') | length > 0 # cephadm runs w/ root privileges become: true ansible.builtin.shell: "{{ ceph_cli }} config set {{ mds_aff_daemon.name }} mds_join_fs cephfs" # Remove labels from the controller nodes: it will force a failover and migrate # the existing active MDS daemon to the target node - name: Remove MDS label from the overcloud nodes ansible.builtin.import_tasks: labels.yaml vars: nodes: "{{ decomm_nodes }}" act: "rm" labels: - "mds" # Wait for the redeploy to finish before moving to the next stage - name: Wait daemons ansible.builtin.include_tasks: wait_daemons.yaml vars: daemon: mds daemon_id: - name: Sleep before moving to the next phase ansible.builtin.pause: seconds: "{{ ceph_timeout }}"