ansible-nas/tasks/stats.yml
animeai ce21999f46 Map all ports as variables in all.yml.dist
NOTE: The majority of traefik ports were totally broken and would never have worked. It should be the external port there, not the internal container port!.

Port conflicts were fixed.
2020-01-05 21:47:40 +00:00

74 lines
No EOL
2 KiB
YAML

---
- name: Create InfluxDB and Telegraf Directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ influxdb_data_directory }}"
- "{{ telegraf_data_directory }}"
- name: Create Grafana Directories
file:
path: "{{ item }}"
state: directory
owner: "472"
recurse: yes
with_items:
- "{{ 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:
- "{{ grafana_influxdb_port }}:8086"
restart_policy: unless-stopped
env:
INFLUXDB_LOGGING_LEVEL: "error"
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:
- "{{ grafana_port }}:3000"
restart_policy: unless-stopped
memory: 1g
labels:
traefik.backend: "grafana"
traefik.frontend.rule: "Host:grafana.{{ ansible_nas_domain }}"
traefik.enable: "{{ grafana_available_externally }}"
traefik.port: "{{ grafana_port }}"