deep_scrub_choked
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
---
|
||||
galaxy_info:
|
||||
company: Red Hat
|
||||
author: Boris Ranto
|
||||
description: Configures Grafana for Ceph Dashboard
|
||||
license: Apache
|
||||
min_ansible_version: "2.4"
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 'all'
|
||||
galaxy_tags:
|
||||
- system
|
||||
dependencies: []
|
||||
@@ -0,0 +1,117 @@
|
||||
---
|
||||
- name: Install ceph-grafana-dashboards package on RedHat or SUSE
|
||||
ansible.builtin.package:
|
||||
name: ceph-grafana-dashboards
|
||||
state: "{{ (upgrade_ceph_packages | bool) | ternary('latest', 'present') }}"
|
||||
register: result
|
||||
until: result is succeeded
|
||||
when:
|
||||
- not containerized_deployment | bool
|
||||
- ansible_facts['os_family'] in ['RedHat', 'Suse']
|
||||
tags: package-install
|
||||
|
||||
- name: Make sure grafana is down
|
||||
ansible.builtin.service:
|
||||
name: grafana-server
|
||||
state: stopped
|
||||
|
||||
- name: Wait for grafana to be stopped
|
||||
ansible.builtin.wait_for:
|
||||
host: '{{ grafana_server_addr if ip_version == "ipv4" else grafana_server_addr[1:-1] }}'
|
||||
port: '{{ grafana_port }}'
|
||||
state: stopped
|
||||
|
||||
- name: Make sure grafana configuration directories exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
recurse: true
|
||||
owner: "{{ grafana_uid }}"
|
||||
group: "{{ grafana_uid }}"
|
||||
with_items:
|
||||
- "/etc/grafana/dashboards/ceph-dashboard"
|
||||
- "/etc/grafana/provisioning/datasources"
|
||||
- "/etc/grafana/provisioning/dashboards"
|
||||
- "/etc/grafana/provisioning/notifiers"
|
||||
|
||||
- name: Download ceph grafana dashboards
|
||||
ansible.builtin.get_url:
|
||||
url: "https://raw.githubusercontent.com/ceph/ceph/{{ grafana_dashboard_version }}/monitoring/ceph-mixin/dashboards_out/{{ item }}"
|
||||
dest: "/etc/grafana/dashboards/ceph-dashboard/{{ item }}"
|
||||
mode: "0644"
|
||||
with_items: "{{ grafana_dashboard_files }}"
|
||||
when:
|
||||
- not containerized_deployment | bool
|
||||
- not ansible_facts['os_family'] in ['RedHat', 'Suse']
|
||||
|
||||
- name: Write grafana.ini
|
||||
openstack.config_template.config_template:
|
||||
src: grafana.ini.j2
|
||||
dest: /etc/grafana/grafana.ini
|
||||
owner: "{{ grafana_uid }}"
|
||||
group: "{{ grafana_uid }}"
|
||||
mode: "0640"
|
||||
config_type: ini
|
||||
config_overrides: "{{ grafana_conf_overrides }}"
|
||||
|
||||
- name: Write datasources provisioning config file
|
||||
ansible.builtin.template:
|
||||
src: datasources-ceph-dashboard.yml.j2
|
||||
dest: /etc/grafana/provisioning/datasources/ceph-dashboard.yml
|
||||
owner: "{{ grafana_uid }}"
|
||||
group: "{{ grafana_uid }}"
|
||||
mode: "0640"
|
||||
|
||||
- name: Write dashboards provisioning config file
|
||||
ansible.builtin.template:
|
||||
src: dashboards-ceph-dashboard.yml.j2
|
||||
dest: /etc/grafana/provisioning/dashboards/ceph-dashboard.yml
|
||||
owner: "{{ grafana_uid }}"
|
||||
group: "{{ grafana_uid }}"
|
||||
mode: "0640"
|
||||
when: not containerized_deployment | bool
|
||||
|
||||
- name: Copy grafana SSL certificate file
|
||||
ansible.builtin.copy:
|
||||
src: "{{ grafana_crt }}"
|
||||
dest: "/etc/grafana/ceph-dashboard.crt"
|
||||
owner: "{{ grafana_uid }}"
|
||||
group: "{{ grafana_uid }}"
|
||||
mode: "0640"
|
||||
remote_src: "{{ dashboard_tls_external | bool }}"
|
||||
when:
|
||||
- grafana_crt | length > 0
|
||||
- dashboard_protocol == "https"
|
||||
|
||||
- name: Copy grafana SSL certificate key
|
||||
ansible.builtin.copy:
|
||||
src: "{{ grafana_key }}"
|
||||
dest: "/etc/grafana/ceph-dashboard.key"
|
||||
owner: "{{ grafana_uid }}"
|
||||
group: "{{ grafana_uid }}"
|
||||
mode: "0440"
|
||||
remote_src: "{{ dashboard_tls_external | bool }}"
|
||||
when:
|
||||
- grafana_key | length > 0
|
||||
- dashboard_protocol == "https"
|
||||
|
||||
- name: Generate a Self Signed OpenSSL certificate for dashboard
|
||||
ansible.builtin.shell: |
|
||||
test -f /etc/grafana/ceph-dashboard.key -a -f /etc/grafana/ceph-dashboard.crt || \
|
||||
(openssl req -new -nodes -x509 -subj '/O=IT/CN=ceph-grafana' -days 3650 -keyout /etc/grafana/ceph-dashboard.key -out /etc/grafana/ceph-dashboard.crt -extensions v3_ca && \
|
||||
chown {{ grafana_uid }}:{{ grafana_uid }} /etc/grafana/ceph-dashboard.key /etc/grafana/ceph-dashboard.crt)
|
||||
changed_when: false
|
||||
when:
|
||||
- dashboard_protocol == "https"
|
||||
- grafana_key | length == 0 or grafana_crt | length == 0
|
||||
|
||||
- name: Enable and start grafana
|
||||
ansible.builtin.service:
|
||||
name: grafana-server
|
||||
state: restarted
|
||||
enabled: true
|
||||
|
||||
- name: Wait for grafana to start
|
||||
ansible.builtin.wait_for:
|
||||
host: '{{ grafana_server_addr if ip_version == "ipv4" else grafana_server_addr[1:-1] }}'
|
||||
port: '{{ grafana_port }}'
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: Include setup_container.yml
|
||||
ansible.builtin.include_tasks: setup_container.yml
|
||||
|
||||
- name: Include configure_grafana.yml
|
||||
ansible.builtin.include_tasks: configure_grafana.yml
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
- name: Create /etc/grafana and /var/lib/grafana
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ grafana_uid }}"
|
||||
group: "{{ grafana_uid }}"
|
||||
recurse: true
|
||||
with_items:
|
||||
- /etc/grafana
|
||||
- /var/lib/grafana
|
||||
|
||||
- name: Include_tasks systemd.yml
|
||||
ansible.builtin.include_tasks: systemd.yml
|
||||
|
||||
- name: Start the grafana-server service
|
||||
ansible.builtin.systemd:
|
||||
name: grafana-server
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
failed_when: false
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Ship systemd service
|
||||
ansible.builtin.template:
|
||||
src: grafana-server.service.j2
|
||||
dest: "/etc/systemd/system/grafana-server.service"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: 'Ceph Dashboard'
|
||||
orgId: 1
|
||||
folder: 'ceph-dashboard'
|
||||
type: file
|
||||
disableDeletion: false
|
||||
updateIntervalSeconds: 3
|
||||
editable: false
|
||||
options:
|
||||
path: '{{ grafana_dashboards_path }}'
|
||||
@@ -0,0 +1,26 @@
|
||||
apiVersion: 1
|
||||
|
||||
# list of datasources that should be deleted from the database
|
||||
deleteDatasources:
|
||||
- name: '{{ grafana_datasource }}'
|
||||
orgId: 1
|
||||
|
||||
# list of datasources to insert/update depending
|
||||
# what's available in the database
|
||||
datasources:
|
||||
# <string, required> name of the datasource. Required
|
||||
- name: '{{ grafana_datasource }}'
|
||||
# <string, required> datasource type. Required
|
||||
type: 'prometheus'
|
||||
# <string, required> access mode. proxy or direct (Server or Browser in the UI). Required
|
||||
access: 'proxy'
|
||||
# <int> org id. will default to orgId 1 if not specified
|
||||
orgId: 1
|
||||
# <string> url
|
||||
url: 'http://{{ grafana_server_addr }}:{{ prometheus_port }}'
|
||||
# <bool> enable/disable basic auth
|
||||
basicAuth: false
|
||||
# <bool> mark as default datasource. Max one per org
|
||||
isDefault: true
|
||||
# <bool> allow users to edit datasources from the UI.
|
||||
editable: false
|
||||
@@ -0,0 +1,61 @@
|
||||
# This file is managed by ansible, don't make changes here - they will be
|
||||
# overwritten.
|
||||
[Unit]
|
||||
Description=grafana-server
|
||||
{% if container_binary == 'docker' %}
|
||||
After=docker.service network-online.target local-fs.target time-sync.target
|
||||
Requires=docker.service
|
||||
{% else %}
|
||||
After=network-online.target local-fs.target time-sync.target
|
||||
{% endif %}
|
||||
Wants=network-online.target local-fs.target time-sync.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/environment
|
||||
{% if container_binary == 'podman' %}
|
||||
ExecStartPre=-/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
|
||||
ExecStartPre=-/usr/bin/{{ container_binary }} rm --storage grafana-server
|
||||
{% else %}
|
||||
ExecStartPre=-/usr/bin/{{ container_binary }} stop grafana-server
|
||||
{% endif %}
|
||||
ExecStartPre=-/usr/bin/{{ container_binary }} rm grafana-server
|
||||
ExecStart=/usr/bin/{{ container_binary }} run --rm --name=grafana-server \
|
||||
{% if container_binary == 'podman' %}
|
||||
-d --log-driver journald --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid \
|
||||
{% endif %}
|
||||
--pids-limit={{ 0 if container_binary == 'podman' else -1 }} \
|
||||
-v /etc/grafana:/etc/grafana:Z \
|
||||
-v /var/lib/grafana:/var/lib/grafana:Z \
|
||||
--net=host \
|
||||
--cpu-period={{ grafana_container_cpu_period }} \
|
||||
--cpu-quota={{ grafana_container_cpu_period * grafana_container_cpu_cores }} \
|
||||
--memory={{ grafana_container_memory }}GB \
|
||||
--memory-swap={{ grafana_container_memory * 2 }}GB \
|
||||
-e GF_INSTALL_PLUGINS={{ grafana_plugins|join(',') }} \
|
||||
{% if ceph_docker_http_proxy is defined %}
|
||||
-e http_proxy={{ ceph_docker_http_proxy }} \
|
||||
{% endif %}
|
||||
{% if ceph_docker_https_proxy is defined %}
|
||||
-e https_proxy={{ ceph_docker_https_proxy }} \
|
||||
{% endif %}
|
||||
{% if ceph_docker_no_proxy is defined %}
|
||||
-e no_proxy={{ ceph_docker_no_proxy }} \
|
||||
{% endif %}
|
||||
{{ grafana_container_image }}
|
||||
{% if container_binary == 'podman' %}
|
||||
ExecStop=-/usr/bin/sh -c "/usr/bin/{{ container_binary }} rm -f `cat /%t/%n-cid`"
|
||||
{% else %}
|
||||
ExecStop=-/usr/bin/{{ container_binary }} stop grafana-server
|
||||
{% endif %}
|
||||
KillMode=none
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
TimeoutStartSec=120
|
||||
TimeoutStopSec=15
|
||||
{% if container_binary == 'podman' %}
|
||||
Type=forking
|
||||
PIDFile=/%t/%n-pid
|
||||
{% endif %}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,35 @@
|
||||
# [server]
|
||||
# root_url = %(protocol)s://%(domain)s:%(http_port)s/api/grafana/proxy
|
||||
|
||||
[users]
|
||||
default_theme = light
|
||||
|
||||
#################################### Anonymous Auth ##########################
|
||||
[auth.anonymous]
|
||||
# enable anonymous access
|
||||
enabled = true
|
||||
|
||||
# specify organization name that should be used for unauthenticated users
|
||||
org_name = Main Org.
|
||||
|
||||
# specify role for unauthenticated users
|
||||
org_role = Viewer
|
||||
|
||||
[server]
|
||||
cert_file = /etc/grafana/ceph-dashboard.crt
|
||||
cert_key = /etc/grafana/ceph-dashboard.key
|
||||
domain = {{ ansible_facts['fqdn'] }}
|
||||
protocol = {{ dashboard_protocol }}
|
||||
http_port = {{ grafana_port }}
|
||||
http_addr = {{ grafana_server_addr }}
|
||||
|
||||
[security]
|
||||
admin_user = {{ grafana_admin_user }}
|
||||
admin_password = {{ grafana_admin_password }}
|
||||
allow_embedding = {{ grafana_allow_embedding }}
|
||||
{% if dashboard_protocol == 'https' %}
|
||||
cookie_secure = true
|
||||
|
||||
[session]
|
||||
cookie_secure = true
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user