add .j2 to all templates file related to dashboard roles.
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
- name: write grafana.ini
template:
- src: grafana.ini
+ src: grafana.ini.j2
dest: /etc/grafana/grafana.ini
mode: 0640
- name: write datasources provisioning config file
template:
- src: datasources-ceph-dashboard.yml
+ src: datasources-ceph-dashboard.yml.j2
dest: /etc/grafana/provisioning/datasources/ceph-dashboard.yml
mode: 0640
- name: Write dashboards provisioning config file
template:
- src: dashboards-ceph-dashboard.yml
+ src: dashboards-ceph-dashboard.yml.j2
dest: /etc/grafana/provisioning/dashboards/ceph-dashboard.yml
mode: 0640
- name: ship systemd service
template:
- src: grafana-server.service
- dest: "/etc/systemd/system/"
+ src: grafana-server.service.j2
+ dest: "/etc/systemd/system/grafana-server.service"
owner: root
group: root
mode: 0644
+++ /dev/null
-apiVersion: 1
-
-providers:
-- name: 'Ceph Dashboard'
- orgId: 1
- folder: 'ceph-dashboard'
- type: file
- disableDeletion: false
- updateIntervalSeconds: 3
- editable: false
- options:
- path: '{{ grafana_dashboards_path }}'
--- /dev/null
+apiVersion: 1
+
+providers:
+- name: 'Ceph Dashboard'
+ orgId: 1
+ folder: 'ceph-dashboard'
+ type: file
+ disableDeletion: false
+ updateIntervalSeconds: 3
+ editable: false
+ options:
+ path: '{{ grafana_dashboards_path }}'
+++ /dev/null
-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://{{ groups["grafana-server"][0] }}:9090'
- # <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
--- /dev/null
+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://{{ groups["grafana-server"][0] }}:9090'
+ # <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
+++ /dev/null
-# 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
-{% endif %}
-
-[Service]
-EnvironmentFile=-/etc/environment
-ExecStart=/usr/bin/{{ container_binary }} start --attach grafana-server
-ExecStop=-/usr/bin/{{ container_binary }} stop grafana-server
-Restart=always
-RestartSec=10s
-TimeoutStartSec=120
-TimeoutStopSec=15
-
-[Install]
-WantedBy=multi-user.target
--- /dev/null
+# 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
+{% endif %}
+
+ [Service]
+EnvironmentFile=-/etc/environment
+ExecStart=/usr/bin/{{ container_binary }} start --attach grafana-server
+ExecStop=-/usr/bin/{{ container_binary }} stop grafana-server
+Restart=always
+RestartSec=10s
+TimeoutStartSec=120
+TimeoutStopSec=15
+
+ [Install]
+WantedBy=multi-user.target
\ No newline at end of file
+++ /dev/null
-# [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_fqdn }}
-protocol = {{ dashboard_protocol }}
-
-[security]
-admin_user = {{ grafana_admin_user }}
-admin_password = {{ grafana_admin_password }}
--- /dev/null
+# [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_fqdn }}
+protocol = {{ dashboard_protocol }}
+
+[security]
+admin_user = {{ grafana_admin_user }}
+admin_password = {{ grafana_admin_password }}
- name: ship systemd service
template:
- src: node_exporter.service
- dest: "/etc/systemd/system/"
+ src: node_exporter.service.j2
+ dest: "/etc/systemd/system/node_exporter.service"
owner: root
group: root
mode: 0644
+++ /dev/null
-# This file is managed by ansible, don't make changes here - they will be
-# overwritten.
-[Unit]
-Description=Node Exporter
-{% if container_binary == 'docker' %}
-After=docker.service
-{% endif %}
-
-[Service]
-EnvironmentFile=-/etc/environment
-ExecStart=/usr/bin/{{ container_binary }} start --attach node-exporter
-# Make sure the cfg80211 is loaded before running the container, the node
-# exporter needs this module loaded to test for presence of wi-fi devices
-ExecStartPre=/usr/sbin/modprobe cfg80211
-ExecStop=-/usr/bin/{{ container_binary }} stop node-exporter
-Restart=always
-RestartSec=10s
-TimeoutStartSec=120
-TimeoutStopSec=15
-
-[Install]
-WantedBy=multi-user.target
--- /dev/null
+# This file is managed by ansible, don't make changes here - they will be
+# overwritten.
+[Unit]
+Description=Node Exporter
+{% if container_binary == 'docker' %}
+After=docker.service
+{% endif %}
+
+[Service]
+EnvironmentFile=-/etc/environment
+ExecStart=/usr/bin/{{ container_binary }} start --attach node-exporter
+# Make sure the cfg80211 is loaded before running the container, the node
+# exporter needs this module loaded to test for presence of wi-fi devices
+ExecStartPre=/usr/sbin/modprobe cfg80211
+ExecStop=-/usr/bin/{{ container_binary }} stop node-exporter
+Restart=always
+RestartSec=10s
+TimeoutStartSec=120
+TimeoutStopSec=15
+
+[Install]
+WantedBy=multi-user.target
- name: write prometheus config file
template:
- src: prometheus.yml
+ src: prometheus.yml.j2
dest: "{{ prometheus_conf_dir }}/"
owner: "{{ prometheus_user_id }}"
notify: service handler
- name: write alertmanager config file
template:
- src: alertmanager.yml
+ src: alertmanager.yml.j2
dest: "{{ alertmanager_conf_dir }}/"
owner: "root"
notify: service handler
- name: ship systemd services
template:
- src: "{{ item }}"
- dest: "/etc/systemd/system/"
+ src: "{{ item }}.j2"
+ dest: "/etc/systemd/system/{{ item }}"
owner: root
group: root
mode: 0644
+++ /dev/null
-# This file is managed by ansible, don't make changes here - they will be
-# overwritten.
-[Unit]
-Description=alertmanager
-{% if container_binary == 'docker' %}
-After=docker.service
-{% endif %}
-
-[Service]
-EnvironmentFile=-/etc/environment
-ExecStart=/usr/bin/{{ container_binary }} start --attach alertmanager
-ExecStop=/usr/bin/{{ container_binary }} stop alertmanager
-Restart=always
-RestartSec=10s
-TimeoutStartSec=120
-TimeoutStopSec=15
-
-[Install]
-WantedBy=multi-user.target
--- /dev/null
+# This file is managed by ansible, don't make changes here - they will be
+# overwritten.
+[Unit]
+Description=alertmanager
+{% if container_binary == 'docker' %}
+After=docker.service
+{% endif %}
+
+[Service]
+EnvironmentFile=-/etc/environment
+ExecStart=/usr/bin/{{ container_binary }} start --attach alertmanager
+ExecStop=/usr/bin/{{ container_binary }} stop alertmanager
+Restart=always
+RestartSec=10s
+TimeoutStartSec=120
+TimeoutStopSec=15
+
+[Install]
+WantedBy=multi-user.target
+++ /dev/null
-global:
- resolve_timeout: 5m
-
-route:
- group_by: ['alertname']
- group_wait: 10s
- group_interval: 10s
- repeat_interval: 1h
- receiver: 'ceph-dashboard'
-receivers:
-- name: 'ceph-dashboard'
- webhook_configs:
-{% for host in groups['mgrs'] | default(groups['mons']) %}
- - url: '{{ dashboard_protocol }}://{{ host }}:{{ dashboard_port }}/api/prometheus_receiver'
-{% endfor %}
--- /dev/null
+global:
+ resolve_timeout: 5m
+
+route:
+ group_by: ['alertname']
+ group_wait: 10s
+ group_interval: 10s
+ repeat_interval: 1h
+ receiver: 'ceph-dashboard'
+receivers:
+- name: 'ceph-dashboard'
+ webhook_configs:
+{% for host in groups['mgrs'] | default(groups['mons']) %}
+ - url: '{{ dashboard_protocol }}://{{ host }}:{{ dashboard_port }}/api/prometheus_receiver'
+{% endfor %}
+++ /dev/null
-# This file is managed by ansible, don't make changes here - they will be
-# overwritten.
-[Unit]
-Description=prometheus
-{% if container_binary == 'docker' %}
-After=docker.service
-{% endif %}
-
-[Service]
-EnvironmentFile=-/etc/environment
-ExecStart=/usr/bin/{{ container_binary }} start --attach prometheus
-ExecStop=/usr/bin/{{ container_binary }} stop prometheus
-Restart=always
-RestartSec=10s
-TimeoutStartSec=120
-TimeoutStopSec=15
-
-[Install]
-WantedBy=multi-user.target
--- /dev/null
+# This file is managed by ansible, don't make changes here - they will be
+# overwritten.
+[Unit]
+Description=prometheus
+{% if container_binary == 'docker' %}
+After=docker.service
+{% endif %}
+
+[Service]
+EnvironmentFile=-/etc/environment
+ExecStart=/usr/bin/{{ container_binary }} start --attach prometheus
+ExecStop=/usr/bin/{{ container_binary }} stop prometheus
+Restart=always
+RestartSec=10s
+TimeoutStartSec=120
+TimeoutStopSec=15
+
+[Install]
+WantedBy=multi-user.target
+++ /dev/null
-global:
- scrape_interval: 15s
- evaluation_interval: 15s
-
-rule_files:
- - '/etc/prometheus/alerting/*'
-
-scrape_configs:
- - job_name: 'prometheus'
- static_configs:
- - targets: ['localhost:9090']
- - job_name: 'ceph'
- honor_labels: true
- static_configs:
-{% for host in groups['mgrs'] | default(groups['mons']) %}
- - targets: ['{{ host }}:9283']
- labels:
- instance: 'ceph_cluster'
-{% endfor %}
- - job_name: 'node'
- static_configs:
-{% for host in (groups['all'] | difference(groups['grafana-server'])) %}
- - targets: ['{{ host }}:9100']
- labels:
- instance: "{{ hostvars[host]['ansible_nodename'] }}"
-{% endfor %}
- - job_name: 'grafana'
- static_configs:
-{% for host in groups['grafana-server'] %}
- - targets: ['{{ host }}:9100']
- labels:
- instance: "{{ hostvars[host]['ansible_nodename'] }}"
-{% endfor %}
-{% if 'iscsigws' in groups %}
- - job_name: 'iscsi-gws'
- static_configs:
-{% for host in groups['iscsigws'] %}
- - targets: ['{{ host }}:9287']
- labels:
- instance: "{{ hostvars[host]['ansible_nodename'] }}"
-{% endfor %}
-{% endif %}
-alerting:
- alertmanagers:
- - scheme: http
- static_configs:
- - targets: ['{{ groups["grafana-server"][0] }}:9093']
--- /dev/null
+global:
+ scrape_interval: 15s
+ evaluation_interval: 15s
+
+rule_files:
+ - '/etc/prometheus/alerting/*'
+
+scrape_configs:
+ - job_name: 'prometheus'
+ static_configs:
+ - targets: ['localhost:9090']
+ - job_name: 'ceph'
+ honor_labels: true
+ static_configs:
+{% for host in groups['mgrs'] | default(groups['mons']) %}
+ - targets: ['{{ host }}:9283']
+ labels:
+ instance: 'ceph_cluster'
+{% endfor %}
+ - job_name: 'node'
+ static_configs:
+{% for host in (groups['all'] | difference(groups['grafana-server'])) %}
+ - targets: ['{{ host }}:9100']
+ labels:
+ instance: "{{ hostvars[host]['ansible_nodename'] }}"
+{% endfor %}
+ - job_name: 'grafana'
+ static_configs:
+{% for host in groups['grafana-server'] %}
+ - targets: ['{{ host }}:9100']
+ labels:
+ instance: "{{ hostvars[host]['ansible_nodename'] }}"
+{% endfor %}
+{% if 'iscsigws' in groups %}
+ - job_name: 'iscsi-gws'
+ static_configs:
+{% for host in groups['iscsigws'] %}
+ - targets: ['{{ host }}:9287']
+ labels:
+ instance: "{{ hostvars[host]['ansible_nodename'] }}"
+{% endfor %}
+{% endif %}
+alerting:
+ alertmanagers:
+ - scheme: http
+ static_configs:
+ - targets: ['{{ groups["grafana-server"][0] }}:9093']