2018-04-08 22:29:25 +00:00
|
|
|
---
|
2018-11-12 23:19:31 +00:00
|
|
|
- name: Create InfluxDB and Telegraf Directories
|
2018-04-08 22:29:25 +00:00
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
with_items:
|
|
|
|
- "{{ influxdb_data_directory }}"
|
2018-11-12 23:19:31 +00:00
|
|
|
- "{{ telegraf_data_directory }}"
|
|
|
|
|
|
|
|
- name: Create Grafana Directories
|
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
|
|
|
owner: "472"
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
2018-04-08 22:29:25 +00:00
|
|
|
- "{{ grafana_data_directory }}"
|
|
|
|
- "{{ grafana_data_directory }}/data"
|
|
|
|
- "{{ grafana_data_directory }}/config/"
|
|
|
|
- "{{ grafana_data_directory }}/config/provisioning"
|
|
|
|
- "{{ grafana_data_directory }}/config/provisioning/datasources"
|
|
|
|
|
|
|
|
- name: InfluxDB
|
|
|
|
docker_container:
|
|
|
|
name: influxdb
|
|
|
|
image: influxdb
|
|
|
|
pull: true
|
|
|
|
volumes:
|
|
|
|
- "{{ influxdb_data_directory }}:/var/lib/influxdb:rw"
|
|
|
|
ports:
|
2020-01-05 21:47:40 +00:00
|
|
|
- "{{ grafana_influxdb_port }}:8086"
|
2018-04-08 22:29:25 +00:00
|
|
|
restart_policy: unless-stopped
|
2019-04-27 20:56:00 +00:00
|
|
|
env:
|
|
|
|
INFLUXDB_LOGGING_LEVEL: "error"
|
2018-04-08 22:29:25 +00:00
|
|
|
memory: 1g
|
|
|
|
|
|
|
|
- name: Template telegraf.conf
|
|
|
|
template:
|
|
|
|
src: telegraf/telegraf.conf
|
|
|
|
dest: "{{ telegraf_data_directory }}/telegraf.conf"
|
|
|
|
|
|
|
|
- name: Telegraf
|
|
|
|
docker_container:
|
|
|
|
name: telegraf
|
|
|
|
image: telegraf
|
|
|
|
pull: true
|
|
|
|
volumes:
|
|
|
|
- "{{ telegraf_data_directory }}/telegraf.conf:/etc/telegraf/telegraf.conf:ro"
|
|
|
|
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
|
|
|
restart_policy: unless-stopped
|
|
|
|
memory: 1g
|
|
|
|
|
|
|
|
- name: Template Grafana data source
|
|
|
|
template:
|
|
|
|
src: grafana/provisioning/datasources/ansible-nas.yml
|
|
|
|
dest: "{{ grafana_data_directory }}/config/provisioning/datasources/ansible-nas.yml"
|
|
|
|
|
|
|
|
- name: Grafana
|
|
|
|
docker_container:
|
|
|
|
name: grafana
|
|
|
|
image: grafana/grafana
|
|
|
|
pull: true
|
|
|
|
volumes:
|
|
|
|
- "{{ grafana_data_directory }}/data:/var/lib/grafana:rw"
|
|
|
|
- "{{ grafana_data_directory }}/config/provisioning:/etc/grafana/provisioning:ro"
|
|
|
|
ports:
|
2020-01-05 21:47:40 +00:00
|
|
|
- "{{ grafana_port }}:3000"
|
2018-04-08 22:29:25 +00:00
|
|
|
restart_policy: unless-stopped
|
2019-04-11 22:03:11 +00:00
|
|
|
memory: 1g
|
|
|
|
labels:
|
|
|
|
traefik.backend: "grafana"
|
|
|
|
traefik.frontend.rule: "Host:grafana.{{ ansible_nas_domain }}"
|
|
|
|
traefik.enable: "{{ grafana_available_externally }}"
|
2020-01-05 21:47:40 +00:00
|
|
|
traefik.port: "{{ grafana_port }}"
|