--- # Copyright 2021 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: Build and apply the monitoring stack daemons block: # Using two tasks with a boolean due to the ansible bug: https://github.com/ansible/ansible/issues/68364 - name: Collect the host and build the resulting host list set_fact: _hosts: "{{ _hosts|default([]) + [ hostvars[item].canonical_hostname ] }}" with_items: "{{ groups['ceph_mgr'] }}" when: tripleo_cephadm_fqdn | bool - name: Collect the host and build the resulting host list set_fact: _hosts: "{{ _hosts|default([]) + [ hostvars[item].inventory_hostname ] }}" with_items: "{{ groups['ceph_mgr'] }}" when: not tripleo_cephadm_fqdn | bool - name: Apply node-exporter(s) become: true ceph_mkspec: service_type: "node-exporter" service_id: "node-exporter" service_name: "node-exporter" apply: true host_pattern: "*" render_path: "{{ tripleo_cephadm_spec_home }}" networks: "{{ tripleo_cephadm_monitoring_address_block }}" environment: CEPH_CONTAINER_IMAGE: "{{ tripleo_cephadm_container_ns + '/' + tripleo_cephadm_container_image + ':' + tripleo_cephadm_container_tag }}" CEPH_CONTAINER_BINARY: "{{ tripleo_cephadm_container_cli }}" - name: Config ssl cert(s) and key(s) for the exposed components block: - name: Get ceph_cli include_tasks: ceph_cli.yaml vars: mount_certs: true - name: import grafana certificate file command: "{{ tripleo_cephadm_ceph_cli }} config-key set mgr/cephadm/grafana_crt -i {{ tripleo_cephadm_grafana_crt }}" changed_when: false - name: import grafana certificate key command: "{{ tripleo_cephadm_ceph_cli }} config-key set mgr/cephadm/grafana_key -i {{ tripleo_cephadm_grafana_key }}" changed_when: false when: tripleo_cephadm_dashboard_protocol == "https" and tripleo_cephadm_grafana_crt | length > 0 and tripleo_cephadm_grafana_key | length > 0 - name: Create the monitoring stack Daemon spec definition become: true ceph_mkspec: service_type: "{{ item }}" service_id: "{{ item }}" service_name: "{{ item }}" apply: true hosts: "{{ _hosts | unique }}" render_path: "{{ tripleo_cephadm_spec_home }}" networks: "{{ tripleo_cephadm_monitoring_address_block }}" 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" when: tripleo_cephadm_dashboard_enabled | bool - include_tasks: dashboard/dashboard.yaml when: tripleo_cephadm_dashboard_enabled | bool