2017-03-16 17:17:08 +08:00
|
|
|
---
|
2017-10-04 16:39:17 +08:00
|
|
|
- name: set_fact docker_exec_cmd
|
|
|
|
set_fact:
|
2017-10-16 21:04:23 +08:00
|
|
|
docker_exec_cmd_mgr: "docker exec ceph-mon-{{ hostvars[groups[mon_group_name][0]]['ansible_hostname'] }}"
|
2017-10-04 16:39:17 +08:00
|
|
|
when:
|
|
|
|
- containerized_deployment
|
|
|
|
|
2018-04-11 23:15:29 +08:00
|
|
|
- name: include common.yml
|
|
|
|
include: common.yml
|
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: include pre_requisite.yml
|
|
|
|
include: pre_requisite.yml
|
2017-04-13 01:57:33 +08:00
|
|
|
when: not containerized_deployment
|
2017-03-16 17:17:08 +08:00
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: include docker/main.yml
|
|
|
|
include: docker/main.yml
|
2017-04-13 01:57:33 +08:00
|
|
|
when: containerized_deployment
|
2017-10-16 21:04:23 +08:00
|
|
|
|
|
|
|
- name: get enabled modules from ceph-mgr
|
|
|
|
command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} --format json mgr module ls"
|
mgr: fix enabling of mgr module on mimic
The data structure has slightly changed on mimic.
Prior to mimic, it used to be:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"zabbix"
]
}
```
From mimic it looks like this:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
{
"name": "balancer",
"can_run": true,
"error_string": ""
},
{
"name": "dashboard",
"can_run": true,
"error_string": ""
}
]
}
```
This means we can't simply check if `item` is in `item in
_ceph_mgr_modules.disabled_modules`
the idea here is to use filter `map(attribute='name')` to build a list
when deploying mimic.
Fixes: #2766
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-06-18 23:26:21 +08:00
|
|
|
register: _ceph_mgr_modules
|
2017-10-16 21:04:23 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-10-19 21:39:43 +08:00
|
|
|
when:
|
|
|
|
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
|
2017-10-16 21:04:23 +08:00
|
|
|
|
mgr: fix enabling of mgr module on mimic
The data structure has slightly changed on mimic.
Prior to mimic, it used to be:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"zabbix"
]
}
```
From mimic it looks like this:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
{
"name": "balancer",
"can_run": true,
"error_string": ""
},
{
"name": "dashboard",
"can_run": true,
"error_string": ""
}
]
}
```
This means we can't simply check if `item` is in `item in
_ceph_mgr_modules.disabled_modules`
the idea here is to use filter `map(attribute='name')` to build a list
when deploying mimic.
Fixes: #2766
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-06-18 23:26:21 +08:00
|
|
|
- name: set _ceph_mgr_modules fact (convert _ceph_mgr_modules.stdout to a dict)
|
2018-05-18 03:17:29 +08:00
|
|
|
set_fact:
|
mgr: fix enabling of mgr module on mimic
The data structure has slightly changed on mimic.
Prior to mimic, it used to be:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"zabbix"
]
}
```
From mimic it looks like this:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
{
"name": "balancer",
"can_run": true,
"error_string": ""
},
{
"name": "dashboard",
"can_run": true,
"error_string": ""
}
]
}
```
This means we can't simply check if `item` is in `item in
_ceph_mgr_modules.disabled_modules`
the idea here is to use filter `map(attribute='name')` to build a list
when deploying mimic.
Fixes: #2766
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-06-18 23:26:21 +08:00
|
|
|
_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:
|
2018-08-15 20:50:19 +08:00
|
|
|
_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 %}"
|
mgr: fix enabling of mgr module on mimic
The data structure has slightly changed on mimic.
Prior to mimic, it used to be:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"zabbix"
]
}
```
From mimic it looks like this:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
{
"name": "balancer",
"can_run": true,
"error_string": ""
},
{
"name": "dashboard",
"can_run": true,
"error_string": ""
}
]
}
```
This means we can't simply check if `item` is in `item in
_ceph_mgr_modules.disabled_modules`
the idea here is to use filter `map(attribute='name')` to build a list
when deploying mimic.
Fixes: #2766
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-06-18 23:26:21 +08:00
|
|
|
when:
|
|
|
|
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
|
2018-05-18 03:17:29 +08:00
|
|
|
|
2017-10-16 21:04:23 +08:00
|
|
|
- name: disable ceph mgr enabled modules
|
|
|
|
command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr module disable {{ item }}"
|
2017-10-18 17:43:40 +08:00
|
|
|
# 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.
|
mgr: fix enabling of mgr module on mimic
The data structure has slightly changed on mimic.
Prior to mimic, it used to be:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"zabbix"
]
}
```
From mimic it looks like this:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
{
"name": "balancer",
"can_run": true,
"error_string": ""
},
{
"name": "dashboard",
"can_run": true,
"error_string": ""
}
]
}
```
This means we can't simply check if `item` is in `item in
_ceph_mgr_modules.disabled_modules`
the idea here is to use filter `map(attribute='name')` to build a list
when deploying mimic.
Fixes: #2766
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-06-18 23:26:21 +08:00
|
|
|
with_items: "{{ _ceph_mgr_modules.get('enabled_modules', []) }}"
|
2017-10-16 21:04:23 +08:00
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-10-18 17:43:40 +08:00
|
|
|
when:
|
2018-05-18 03:17:29 +08:00
|
|
|
- item not in ceph_mgr_modules
|
mgr: fix enabling of mgr module on mimic
The data structure has slightly changed on mimic.
Prior to mimic, it used to be:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"zabbix"
]
}
```
From mimic it looks like this:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
{
"name": "balancer",
"can_run": true,
"error_string": ""
},
{
"name": "dashboard",
"can_run": true,
"error_string": ""
}
]
}
```
This means we can't simply check if `item` is in `item in
_ceph_mgr_modules.disabled_modules`
the idea here is to use filter `map(attribute='name')` to build a list
when deploying mimic.
Fixes: #2766
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-06-18 23:26:21 +08:00
|
|
|
- not _ceph_mgr_modules.get('skipped')
|
2017-10-19 21:39:43 +08:00
|
|
|
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
|
2017-10-16 21:04:23 +08:00
|
|
|
|
|
|
|
- name: add modules to ceph-mgr
|
2018-05-18 03:17:29 +08:00
|
|
|
command: "{{ docker_exec_cmd_mgr | default('') }} ceph --cluster {{ cluster }} mgr module enable {{ item }}"
|
2017-10-16 21:04:23 +08:00
|
|
|
with_items: "{{ ceph_mgr_modules }}"
|
|
|
|
delegate_to: "{{ groups[mon_group_name][0] }}"
|
2017-10-19 21:39:43 +08:00
|
|
|
when:
|
mgr: backward compatibility for module management
Follow up on 3abc253fecc91f29c90e23ae95e1b83f8ffd3de6
The structure had even changed within `luminous` release.
It was first:
```
{
"enabled_modules": [
"balancer",
"dashboard",
"restful",
"status"
],
"disabled_modules": [
"influx",
"localpool",
"prometheus",
"selftest",
"zabbix"
]
}
```
Then it changed for:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
"balancer",
"dashboard",
"influx",
"localpool",
"prometheus",
"restful",
"selftest",
"zabbix"
]
}
```
and finally:
```
{
"enabled_modules": [
"status"
],
"disabled_modules": [
{
"name": "balancer",
"can_run": true,
"error_string": ""
},
{
"name": "dashboard",
"can_run": true,
"error_string": ""
}
]
}
```
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
2018-08-07 20:46:07 +08:00
|
|
|
- (item in _disabled_ceph_mgr_modules or _disabled_ceph_mgr_modules == [])
|
2017-10-19 21:39:43 +08:00
|
|
|
- ceph_release_num[ceph_release] >= ceph_release_num['luminous']
|