ceph-ansible/roles/ceph-mgr/tasks/main.yml

56 lines
2.3 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

---
- name: set_fact docker_exec_cmd
set_fact:
docker_exec_cmd_mgr: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
when:
- containerized_deployment
- name: include common.yml
include: common.yml
- name: include pre_requisite.yml
include: pre_requisite.yml
when: not containerized_deployment
- name: include docker/main.yml
include: docker/main.yml
when: containerized_deployment
- name: get enabled modules from ceph-mgr
command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} --format json mgr module ls"
register: _ceph_mgr_modules
delegate_to: "{{ groups[mon_group_name][0] }}"
when:
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
- name: set _ceph_mgr_modules fact (convert _ceph_mgr_modules.stdout to a dict)
set_fact:
_ceph_mgr_modules: "{{ _ceph_mgr_modules.get('stdout', '{}') | from_json }}"
when:
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
- name: set _disabled_ceph_mgr_modules fact
set_fact:
_disabled_ceph_mgr_modules: "{% if ceph_release_num[ceph_release] > ceph_release_num['luminous'] %}{{ _ceph_mgr_modules['disabled_modules'] | map(attribute='name') | list }}{% else %}{{ _ceph_mgr_modules['disabled_modules'] }}{% endif %}"
when:
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
- name: disable ceph mgr enabled modules
command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr module disable {{ item }}"
# When ceph release is jewel, ceph-mgr role is skipped. It means, the enabled_ceph_mgr_modules doesn't contain 'stdout' attribute.
# Therefore, we need to get a default value which can be used up by from_json filter.
with_items: "{{ _ceph_mgr_modules.get('enabled_modules', []) }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
when:
- item not in ceph_mgr_modules
- not _ceph_mgr_modules.get('skipped')
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
- name: add modules to ceph-mgr
command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr module enable {{ item }}"
with_items: "{{ ceph_mgr_modules }}"
delegate_to: "{{ groups[mon_group_name][0] }}"
when:
- item in _disabled_ceph_mgr_modules
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']