Skip to content

Commit

Permalink
Use Ceph monitoring (not RGW) network for Dashboard
Browse files Browse the repository at this point in the history
Use the existing `cifmw_cephadm_monitoring_network`
parameter to configure the Ceph dashboard instead of
the `cifmw_cephadm_rgw_network` parameter. This was
not detected earlier because the Ceph playbook set them
both to the Ceph public_network, but we recently added
a feature to run RGW on a separate network [1].
Also, add retries/delay to the dashboard HTTP check
and mange if HTTPS should be used.

[1] #2301

Jira: https://issues.redhat.com/browse/OSPCIX-506

Signed-off-by: John Fulton <[email protected]>
  • Loading branch information
fultonj authored and openshift-merge-bot[bot] committed Sep 27, 2024
1 parent d14df71 commit f6e4645
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 6 deletions.
3 changes: 3 additions & 0 deletions playbooks/ceph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@
ansible.builtin.import_role:
name: cifmw_cephadm
tasks_from: post
vars:
cifmw_cephadm_dashboard_crt: "{{ cifmw_cephadm_certificate }}"
cifmw_cephadm_dashboard_key: "{{ cifmw_cephadm_key }}"

- name: Render Ceph client configuration
tags: client
Expand Down
2 changes: 2 additions & 0 deletions roles/cifmw_cephadm/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,5 @@ cifmw_cephadm_update_log_commands:
# Get last cephadm logs in case of failure
- type: "mod_cephadm"
cmd: "log last cephadm"
cifmw_cephadm_wait_for_dashboard_retries: 10
cifmw_cephadm_wait_for_dashboard_delay: 20
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
ansible.builtin.command: |
{{ cifmw_cephadm_ceph_cli }} config set \
mgr mgr/dashboard/{{ current_mgr }}/server_addr \
{{ hostvars[item][all_addresses] | ansible.utils.ipaddr(cifmw_cephadm_rgw_network) | first }}
{{ hostvars[item][all_addresses] | ansible.utils.ipaddr(cifmw_cephadm_monitoring_network) | first }}
become: true
36 changes: 34 additions & 2 deletions roles/cifmw_cephadm/tasks/dashboard/validation.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,47 @@
---
# Copyright 2024 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

- name: Update urischeme based on cert/key
ansible.builtin.set_fact:
cifmw_cephadm_urischeme_dashboard: "https"
when:
- cifmw_cephadm_dashboard_crt | default("") | length > 0
- cifmw_cephadm_dashboard_key | default("") | length > 0

- name: Validate connection to dashboard service
ansible.builtin.get_url:
url: "http://{{ grafana_server_addr }}:{{ cifmw_cephadm_dashboard_port }}"
url: "{{ cifmw_cephadm_urischeme_dashboard | default('http') }}://{{ grafana_server_addr }}:{{ cifmw_cephadm_dashboard_port }}"
dest: "/tmp/dash_response"
validate_certs: false
register: dashboard_response
failed_when: dashboard_response.failed == true
until: dashboard_response.failed == false
retries: "{{ cifmw_cephadm_wait_for_dashboard_retries }}"
delay: "{{ cifmw_cephadm_wait_for_dashboard_delay }}"


- name: Check http response code from dashboard service with login
ansible.builtin.get_url:
url: "http://{{ grafana_server_addr }}:{{ cifmw_cephadm_dashboard_port }}"
url: "{{ cifmw_cephadm_urischeme_dashboard | default('http') }}://{{ grafana_server_addr }}:{{ cifmw_cephadm_dashboard_port }}"
dest: "/tmp/dash_http_response"
validate_certs: false
username: admin
password: admin
register: dashboard_resp
failed_when: dashboard_resp.status_code != 200
until: dashboard_resp.status_code == 200
retries: "{{ cifmw_cephadm_wait_for_dashboard_retries }}"
delay: "{{ cifmw_cephadm_wait_for_dashboard_delay }}"
6 changes: 3 additions & 3 deletions roles/cifmw_cephadm/templates/ceph_monitoring_stack.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ placement:
- {{ _hosts[0] }}
count: 1
networks:
- {{ cifmw_cephadm_rgw_network }}
- {{ cifmw_cephadm_monitoring_network }}
---
service_type: prometheus
service_id: prometheus
Expand All @@ -21,7 +21,7 @@ placement:
- {{ _hosts[0] }}
count: 1
networks:
- {{ cifmw_cephadm_rgw_network }}
- {{ cifmw_cephadm_monitoring_network }}
---
service_type: alertmanager
service_id: alertmanager
Expand All @@ -31,4 +31,4 @@ placement:
- {{ _hosts[0] }}
count: 1
networks:
- {{ cifmw_cephadm_rgw_network }}
- {{ cifmw_cephadm_monitoring_network }}

0 comments on commit f6e4645

Please sign in to comment.