2018-12-06 20:58:37 +08:00
|
|
|
---
|
2019-05-22 22:12:16 +08:00
|
|
|
- name: append dashboard modules to ceph_mgr_modules
|
|
|
|
set_fact:
|
2020-04-03 03:58:11 +08:00
|
|
|
ceph_mgr_modules: "{{ ceph_mgr_modules | union(['dashboard', 'prometheus']) }}"
|
2019-05-22 22:12:16 +08:00
|
|
|
when: dashboard_enabled | bool
|
|
|
|
|
2019-04-08 19:34:59 +08:00
|
|
|
- name: wait for all mgr to be up
|
2020-01-15 21:39:16 +08:00
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} mgr dump -f json"
|
2019-04-08 19:34:59 +08:00
|
|
|
register: mgr_dump
|
|
|
|
retries: 30
|
|
|
|
delay: 5
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2019-07-31 15:51:12 +08:00
|
|
|
changed_when: false
|
2019-04-08 19:34:59 +08:00
|
|
|
until:
|
|
|
|
- mgr_dump.rc == 0
|
2019-08-06 17:11:15 +08:00
|
|
|
- (mgr_dump.stdout | from_json).available | bool
|
2020-09-01 17:24:59 +08:00
|
|
|
when: not ansible_check_mode
|
2019-04-08 19:34:59 +08:00
|
|
|
|
2018-12-06 20:58:37 +08:00
|
|
|
- name: get enabled modules from ceph-mgr
|
2020-01-15 21:39:16 +08:00
|
|
|
command: "{{ hostvars[groups[mon_group_name][0]]['container_exec_cmd'] | default('') }} ceph --cluster {{ cluster }} --format json mgr module ls"
|
2019-05-06 16:14:36 +08:00
|
|
|
check_mode: no
|
2018-12-06 20:58:37 +08:00
|
|
|
changed_when: false
|
|
|
|
register: _ceph_mgr_modules
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
|
|
|
|
|
|
|
- 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 }}"
|
|
|
|
|
|
|
|
- name: set _disabled_ceph_mgr_modules fact
|
|
|
|
set_fact:
|
|
|
|
_disabled_ceph_mgr_modules: "{% if _ceph_mgr_modules.disabled_modules | length == 0 %}[]{% elif _ceph_mgr_modules.disabled_modules[0] | type_debug != 'dict' %}{{ _ceph_mgr_modules['disabled_modules'] }}{% else %}{{ _ceph_mgr_modules['disabled_modules'] | map(attribute='name') | list }}{% endif %}"
|
|
|
|
|
|
|
|
- name: disable ceph mgr enabled modules
|
2020-11-16 23:11:20 +08:00
|
|
|
ceph_mgr_module:
|
|
|
|
name: "{{ item }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
state: disable
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2018-12-06 20:58:37 +08:00
|
|
|
with_items: "{{ _ceph_mgr_modules.get('enabled_modules', []) }}"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2019-04-01 23:46:15 +08:00
|
|
|
when: item not in ceph_mgr_modules
|
2018-12-06 20:58:37 +08:00
|
|
|
|
|
|
|
- name: add modules to ceph-mgr
|
2020-11-16 23:11:20 +08:00
|
|
|
ceph_mgr_module:
|
|
|
|
name: "{{ item }}"
|
|
|
|
cluster: "{{ cluster }}"
|
|
|
|
state: enable
|
|
|
|
environment:
|
|
|
|
CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment | bool else None }}"
|
|
|
|
CEPH_CONTAINER_BINARY: "{{ container_binary }}"
|
2018-12-06 20:58:37 +08:00
|
|
|
with_items: "{{ ceph_mgr_modules }}"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2019-04-01 23:46:15 +08:00
|
|
|
when: (item in _disabled_ceph_mgr_modules or _disabled_ceph_mgr_modules == [])
|