Browse Source

Merge "Make the monitoring stack ports configurable for each daemon"

changes/18/795318/1
Zuul 7 days ago
committed by Gerrit Code Review
parent
commit
6c57467103
2 changed files with 20 additions and 7 deletions
  1. +12
    -1
      tripleo_ansible/ansible_plugins/module_utils/ceph_spec.py
  2. +8
    -6
      tripleo_ansible/roles/tripleo_cephadm/tasks/monitoring.yaml

+ 12
- 1
tripleo_ansible/ansible_plugins/module_utils/ceph_spec.py View File

@ -208,7 +208,7 @@ class CephDaemonSpec(object):
# append the spec if provided
if len(self.spec.keys()) > 0:
if self.validate_keys(self.spec.keys(), ALLOWED_SPEC_KEYS):
sp = {'spec': self.filter_spec(self.spec)}
sp = {'spec': self.normalize_spec(self.filter_spec(self.spec))}
else:
raise Exception("Fatal: the spec should be composed by only allowed keywords")
@ -216,6 +216,17 @@ class CephDaemonSpec(object):
spec_template = {**spec_template, **ntw, **self.extra, **pl, **sp}
return spec_template
def normalize_spec(self, spec):
'''
For each spec key we need to make sure
that ports are evaluated as int, otherwise
cephadm fails when the spec is applied.
'''
for k, v in spec.items():
if 'port' in k:
spec[k] = int(v)
return spec
def filter_spec(self, spec):
return {k: v for k, v in spec.items() if v}


+ 8
- 6
tripleo_ansible/roles/tripleo_cephadm/tasks/monitoring.yaml View File

@ -63,20 +63,22 @@
- name: Create the monitoring stack Daemon spec definition
become: true
ceph_mkspec:
service_type: "{{ item }}"
service_id: "{{ item }}"
service_name: "{{ item }}"
service_type: "{{ item.daemon }}"
service_id: "{{ item.daemon }}"
service_name: "{{ item.daemon }}"
apply: true
hosts: "{{ _hosts | unique }}"
render_path: "{{ tripleo_cephadm_spec_home }}"
networks: "{{ tripleo_cephadm_monitoring_address_block }}"
spec:
port: "{{ item.port }}"
environment:
CEPH_CONTAINER_IMAGE: "{{ tripleo_cephadm_container_ns + '/' + tripleo_cephadm_container_image + ':' + tripleo_cephadm_container_tag }}"
CEPH_CONTAINER_BINARY: "{{ tripleo_cephadm_container_cli }}"
with_items:
- "alertmanager"
- "prometheus"
- "grafana"
- {"daemon": "grafana", "port": "{{ tripleo_cephadm_grafana_port | default(3100) }}"}
- {"daemon": "prometheus", "port": "{{ tripleo_cephadm_prometheus_port | default(9092) }}"}
- {"daemon": "alertmanager", "port": "{{ tripleo_cephadm_alertmanager_port | default(9094) }}"}
when: tripleo_cephadm_dashboard_enabled | bool
- include_tasks: dashboard/dashboard.yaml


Loading…
Cancel
Save