add dashboards provisioning
This commit is contained in:
@ -3,25 +3,12 @@
|
||||
assert:
|
||||
that:
|
||||
- "prometheus_server_monitor is defined"
|
||||
tags: ['prometheus_server']
|
||||
|
||||
- name: 'prometheus | server | create docker network'
|
||||
docker_network:
|
||||
name: '{{ prometheus_docker_network }}'
|
||||
tags: ['prometheus_server']
|
||||
|
||||
- name: 'prometheus | server | create docker volume data'
|
||||
docker_volume:
|
||||
name: prometheus_data
|
||||
register: register_docker_volume_prometheus__prometheus_data
|
||||
tags: ['prometheus_server']
|
||||
|
||||
- name: 'prometheus | server | create prometheus directory to /etc'
|
||||
file:
|
||||
path: /etc/prometheus
|
||||
state: directory
|
||||
mode: '0755'
|
||||
tags: ['prometheus_server']
|
||||
|
||||
- name: 'prometheus | server | copy config prometheus yml'
|
||||
template:
|
||||
@ -30,16 +17,14 @@
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
tags: ['prometheus_server']
|
||||
notify:
|
||||
- 'grafana-prometheus | server | restart container'
|
||||
- 'grafana-prometheus-restart'
|
||||
|
||||
- name: "grafana-prometheus | create docker-compose directory"
|
||||
file:
|
||||
path: /opt/docker-compose/grafana-prometheus
|
||||
state: directory
|
||||
mode: '0755'
|
||||
tags: [ 'grafana-prometheus', 'prometheus_server' ]
|
||||
|
||||
- name: "grafana-prometheus | copy docker-compose file"
|
||||
template:
|
||||
@ -48,8 +33,7 @@
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: "grafana-prometheus | server | restart container"
|
||||
tags: [ 'grafana-prometheus' ]
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | create grafana.ini file"
|
||||
file:
|
||||
@ -58,26 +42,9 @@
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
state: touch
|
||||
notify: "grafana-prometheus | server | restart container"
|
||||
tags: [ 'grafana-prometheus' ]
|
||||
notify: "grafana-prometheus-restart"
|
||||
ignore_errors: '{{ ansible_check_mode }}'
|
||||
|
||||
- name: "grafana-prometheus | import grafana provisioned datasources"
|
||||
synchronize:
|
||||
src: "{{ grafana_provisioned_datasources_path }}"
|
||||
dest: /opt/docker-compose/grafana-prometheus/
|
||||
when: grafana_provisioned_datasources_path is defined
|
||||
notify: "grafana-prometheus | server | restart container"
|
||||
tags: [ 'grafana-prometheus' ]
|
||||
|
||||
- name: "grafana-prometheus | import grafana provisioned dashboards"
|
||||
synchronize:
|
||||
src: "{{ grafana_provisioned_dashboards_path }}"
|
||||
dest: /opt/docker-compose/grafana-prometheus/
|
||||
when: grafana_provisioned_datasources_path is defined
|
||||
notify: "grafana-prometheus | server | restart container"
|
||||
tags: [ 'grafana-prometheus' ]
|
||||
|
||||
- name: "grafana-prometheus | install unit file to systemd"
|
||||
vars:
|
||||
exporter: "grafana-prometheus"
|
||||
@ -87,7 +54,6 @@
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0600
|
||||
tags: [ 'grafana-prometheus' ]
|
||||
|
||||
- name: "grafana-prometheus | enable service"
|
||||
systemd:
|
||||
@ -95,4 +61,3 @@
|
||||
name: docker-compose@grafana-prometheus
|
||||
enabled: true
|
||||
ignore_errors: '{{ ansible_check_mode }}'
|
||||
tags: [ 'grafana-prometheus' ]
|
183
tasks/server/grafana-provisioning.yml
Normal file
183
tasks/server/grafana-provisioning.yml
Normal file
@ -0,0 +1,183 @@
|
||||
- name: "grafana-prometheus | import grafana provisioned datasources"
|
||||
synchronize:
|
||||
src: "{{ grafana_provisioned_datasources_path }}"
|
||||
dest: /opt/docker-compose/grafana-prometheus/
|
||||
when: grafana_provisioned_datasources_path is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana provisioned dashboards"
|
||||
synchronize:
|
||||
src: "{{ grafana_provisioned_dashboards_path }}"
|
||||
dest: /opt/docker-compose/grafana-prometheus/
|
||||
when: grafana_provisioned_datasources_path is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana provisioned datasources conf"
|
||||
copy:
|
||||
src: dashboards/datasources.yaml
|
||||
dest: /opt/docker-compose/grafana-prometheus/datasources/datasources.yaml
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: grafana_provisioned_datasources_path is not defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana provisioned dashboards conf"
|
||||
copy:
|
||||
src: dashboards/dashboard.yaml
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/dashboard.yaml
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: grafana_provisioned_dashboards_path is not defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana apache dashboard"
|
||||
copy:
|
||||
src: dashboards/apache.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/apache.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_apache_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana cloudflare dashboard"
|
||||
copy:
|
||||
src: dashboards/cloudflare.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/cloudflare.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_cloudflare_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana docker dashboard"
|
||||
copy:
|
||||
src: dashboards/docker.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/docker.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_docker_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana haproxy dashboard"
|
||||
copy:
|
||||
src: dashboards/haproxy.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/haproxy.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_haproxy_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana memcached dashboard"
|
||||
copy:
|
||||
src: dashboards/memcached.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/memcached.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_memcached_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana mysqld dashboard"
|
||||
copy:
|
||||
src: dashboards/mysqld.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/mysqld.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_mysqld_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana network dashboard"
|
||||
copy:
|
||||
src: dashboards/network.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/network.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_node_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana node-exporter dashboard"
|
||||
copy:
|
||||
src: dashboards/node-exporter.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/node-exporter.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_node_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana opcache dashboard"
|
||||
copy:
|
||||
src: dashboards/opcache.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/opcache.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_opcache_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana overview dashboard"
|
||||
copy:
|
||||
src: dashboards/overview.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/overview.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_node_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana plateform-overview dashboard"
|
||||
copy:
|
||||
src: dashboards/plateform-overview.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/plateform-overview.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_node_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana phpfpm dashboard"
|
||||
copy:
|
||||
src: dashboards/phpfpm.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/phpfpm.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_phpfpm_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana proxmox dashboard"
|
||||
copy:
|
||||
src: dashboards/proxmox.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/proxmox.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_proxmox_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana redis dashboard"
|
||||
copy:
|
||||
src: dashboards/redis.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/redis.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_redis_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
||||
|
||||
- name: "grafana-prometheus | import grafana varnish dashboard"
|
||||
copy:
|
||||
src: dashboards/varnish.json
|
||||
dest: /opt/docker-compose/grafana-prometheus/dashboards/varnish.json
|
||||
owner: '1000'
|
||||
group: '1000'
|
||||
mode: '0750'
|
||||
when: prometheus_varnish_exporter_targets is defined
|
||||
notify: "grafana-prometheus-restart"
|
Reference in New Issue
Block a user