]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
dashboard: rename template files
authorGuillaume Abrioux <gabrioux@redhat.com>
Mon, 13 May 2019 14:21:16 +0000 (16:21 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Thu, 16 May 2019 14:39:13 +0000 (16:39 +0200)
add .j2 to all templates file related to dashboard roles.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
23 files changed:
roles/ceph-grafana/tasks/configure_grafana.yml
roles/ceph-grafana/tasks/setup_container.yml
roles/ceph-grafana/templates/dashboards-ceph-dashboard.yml [deleted file]
roles/ceph-grafana/templates/dashboards-ceph-dashboard.yml.j2 [new file with mode: 0644]
roles/ceph-grafana/templates/datasources-ceph-dashboard.yml [deleted file]
roles/ceph-grafana/templates/datasources-ceph-dashboard.yml.j2 [new file with mode: 0644]
roles/ceph-grafana/templates/grafana-server.service [deleted file]
roles/ceph-grafana/templates/grafana-server.service.j2 [new file with mode: 0644]
roles/ceph-grafana/templates/grafana.ini [deleted file]
roles/ceph-grafana/templates/grafana.ini.j2 [new file with mode: 0644]
roles/ceph-node-exporter/tasks/setup_container.yml
roles/ceph-node-exporter/templates/node_exporter.service [deleted file]
roles/ceph-node-exporter/templates/node_exporter.service.j2 [new file with mode: 0644]
roles/ceph-prometheus/tasks/main.yml
roles/ceph-prometheus/tasks/setup_container.yml
roles/ceph-prometheus/templates/alertmanager.service [deleted file]
roles/ceph-prometheus/templates/alertmanager.service.j2 [new file with mode: 0644]
roles/ceph-prometheus/templates/alertmanager.yml [deleted file]
roles/ceph-prometheus/templates/alertmanager.yml.j2 [new file with mode: 0644]
roles/ceph-prometheus/templates/prometheus.service [deleted file]
roles/ceph-prometheus/templates/prometheus.service.j2 [new file with mode: 0644]
roles/ceph-prometheus/templates/prometheus.yml [deleted file]
roles/ceph-prometheus/templates/prometheus.yml.j2 [new file with mode: 0644]

index e031e171abbad2e12db17ba2b27cee9cd5617d8d..80522e42f48f3f6e01244cd126778449d1b695ee 100644 (file)
 
 - 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
 
index 3bb8dfcc24aa5f25127d623e12733ac46fe961cc..7889d71947f99b4ff9d99b0c5114eb76a026a0c9 100644 (file)
@@ -48,8 +48,8 @@
 
 - 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
diff --git a/roles/ceph-grafana/templates/dashboards-ceph-dashboard.yml b/roles/ceph-grafana/templates/dashboards-ceph-dashboard.yml
deleted file mode 100644 (file)
index 64dbf1d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: 1
-
-providers:
-- name: 'Ceph Dashboard'
-  orgId: 1
-  folder: 'ceph-dashboard'
-  type: file
-  disableDeletion: false
-  updateIntervalSeconds: 3
-  editable: false
-  options:
-    path: '{{ grafana_dashboards_path }}'
diff --git a/roles/ceph-grafana/templates/dashboards-ceph-dashboard.yml.j2 b/roles/ceph-grafana/templates/dashboards-ceph-dashboard.yml.j2
new file mode 100644 (file)
index 0000000..64dbf1d
--- /dev/null
@@ -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 }}'
diff --git a/roles/ceph-grafana/templates/datasources-ceph-dashboard.yml b/roles/ceph-grafana/templates/datasources-ceph-dashboard.yml
deleted file mode 100644 (file)
index 5d5ab01..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-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
diff --git a/roles/ceph-grafana/templates/datasources-ceph-dashboard.yml.j2 b/roles/ceph-grafana/templates/datasources-ceph-dashboard.yml.j2
new file mode 100644 (file)
index 0000000..5d5ab01
--- /dev/null
@@ -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://{{ 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
diff --git a/roles/ceph-grafana/templates/grafana-server.service b/roles/ceph-grafana/templates/grafana-server.service
deleted file mode 100644 (file)
index b242a18..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
diff --git a/roles/ceph-grafana/templates/grafana-server.service.j2 b/roles/ceph-grafana/templates/grafana-server.service.j2
new file mode 100644 (file)
index 0000000..dd64749
--- /dev/null
@@ -0,0 +1,19 @@
+# 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
diff --git a/roles/ceph-grafana/templates/grafana.ini b/roles/ceph-grafana/templates/grafana.ini
deleted file mode 100644 (file)
index 0ea67e9..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# [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 }}
diff --git a/roles/ceph-grafana/templates/grafana.ini.j2 b/roles/ceph-grafana/templates/grafana.ini.j2
new file mode 100644 (file)
index 0000000..0ea67e9
--- /dev/null
@@ -0,0 +1,26 @@
+# [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 }}
index a72e5c20c1cff9bc1c7d578c2cedee5b8ad4b9c7..6a557f23c899701b94292f105fea31647cea433e 100644 (file)
@@ -29,8 +29,8 @@
 
 - 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
diff --git a/roles/ceph-node-exporter/templates/node_exporter.service b/roles/ceph-node-exporter/templates/node_exporter.service
deleted file mode 100644 (file)
index 489ba72..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# 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
diff --git a/roles/ceph-node-exporter/templates/node_exporter.service.j2 b/roles/ceph-node-exporter/templates/node_exporter.service.j2
new file mode 100644 (file)
index 0000000..489ba72
--- /dev/null
@@ -0,0 +1,22 @@
+# 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
index 39f15008e7b8a3842feae70251feed3ef202587f..71affd66b720c9e05d14fa9038791450697db0d2 100644 (file)
@@ -10,7 +10,7 @@
 
 - name: write prometheus config file
   template:
-    src: prometheus.yml
+    src: prometheus.yml.j2
     dest: "{{ prometheus_conf_dir }}/"
     owner: "{{ prometheus_user_id }}"
   notify: service handler
@@ -40,7 +40,7 @@
 
 - name: write alertmanager config file
   template:
-    src: alertmanager.yml
+    src: alertmanager.yml.j2
     dest: "{{ alertmanager_conf_dir }}/"
     owner: "root"
   notify: service handler
index fddbed7d4647d9586ae2b9e505ceb1f66291654e..b78134cf354fbf2fa2e8ee68fbded797ef1d72ff 100644 (file)
@@ -62,8 +62,8 @@
 
 - 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
diff --git a/roles/ceph-prometheus/templates/alertmanager.service b/roles/ceph-prometheus/templates/alertmanager.service
deleted file mode 100644 (file)
index 80eb573..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
diff --git a/roles/ceph-prometheus/templates/alertmanager.service.j2 b/roles/ceph-prometheus/templates/alertmanager.service.j2
new file mode 100644 (file)
index 0000000..80eb573
--- /dev/null
@@ -0,0 +1,19 @@
+# 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
diff --git a/roles/ceph-prometheus/templates/alertmanager.yml b/roles/ceph-prometheus/templates/alertmanager.yml
deleted file mode 100644 (file)
index 4408de0..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-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 %}
diff --git a/roles/ceph-prometheus/templates/alertmanager.yml.j2 b/roles/ceph-prometheus/templates/alertmanager.yml.j2
new file mode 100644 (file)
index 0000000..4408de0
--- /dev/null
@@ -0,0 +1,15 @@
+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 %}
diff --git a/roles/ceph-prometheus/templates/prometheus.service b/roles/ceph-prometheus/templates/prometheus.service
deleted file mode 100644 (file)
index 6971ead..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
diff --git a/roles/ceph-prometheus/templates/prometheus.service.j2 b/roles/ceph-prometheus/templates/prometheus.service.j2
new file mode 100644 (file)
index 0000000..6971ead
--- /dev/null
@@ -0,0 +1,19 @@
+# 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
diff --git a/roles/ceph-prometheus/templates/prometheus.yml b/roles/ceph-prometheus/templates/prometheus.yml
deleted file mode 100644 (file)
index 71dcbb6..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-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']
diff --git a/roles/ceph-prometheus/templates/prometheus.yml.j2 b/roles/ceph-prometheus/templates/prometheus.yml.j2
new file mode 100644 (file)
index 0000000..71dcbb6
--- /dev/null
@@ -0,0 +1,47 @@
+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']