74 lines
2.2 KiB
YAML
74 lines
2.2 KiB
YAML
|
---
|
||
|
# tasks file for grafana
|
||
|
- name: Set up main directory
|
||
|
ansible.builtin.file:
|
||
|
state: directory
|
||
|
path: "{{ item }}"
|
||
|
owner: "{{ ansible_effective_user_id }}"
|
||
|
group: "{{ ansible_effective_group_id }}"
|
||
|
mode: "0750"
|
||
|
with_items:
|
||
|
- "{{ grafana_setup_path | expanduser | realpath }}/grafana-provisioning/"
|
||
|
- "{{ grafana_setup_path | expanduser | realpath }}/grafana-provisioning/datasources/"
|
||
|
tags:
|
||
|
- configuration
|
||
|
become: true
|
||
|
|
||
|
- name: Set up influxdb mount point
|
||
|
ansible.builtin.file:
|
||
|
state: directory
|
||
|
path: "{{ item }}"
|
||
|
owner: "{% if grafana_uid %}{{ grafana_uid }}{% else %}{{ ansible_effective_user_id }}{% endif %}"
|
||
|
group: "{% if grafana_gid %}{{ grafana_gid }}{% else %}{{ ansible_effective_group_id }}{% endif %}"
|
||
|
mode: "0750"
|
||
|
with_items:
|
||
|
- "{{ grafana_volume_influxdb | expanduser | realpath }}"
|
||
|
tags:
|
||
|
- configuration
|
||
|
become: true
|
||
|
|
||
|
- name: Set up grafana mount point
|
||
|
ansible.builtin.file:
|
||
|
state: directory
|
||
|
path: "{{ item }}"
|
||
|
# owner: "{% if grafana_uid %}{{ grafana_uid }}{% else %}{{ ansible_effective_user_id }}{% endif %}"
|
||
|
# group: "{% if grafana_gid %}{{ grafana_gid }}{% else %}{{ ansible_effective_group_id }}{% endif %}"
|
||
|
owner: "472"
|
||
|
group: "0"
|
||
|
mode: "0777"
|
||
|
with_items:
|
||
|
- "{{ grafana_volume_grafana | expanduser | realpath }}"
|
||
|
- "{{ grafana_volume_grafana | expanduser | realpath }}/plugins"
|
||
|
tags:
|
||
|
- configuration
|
||
|
become: true
|
||
|
|
||
|
- name: Write configuration files
|
||
|
ansible.builtin.template:
|
||
|
src: "{{ item }}.j2"
|
||
|
dest: "{{ grafana_setup_path | expanduser | realpath }}/{{ item }}"
|
||
|
mode: '0640'
|
||
|
loop:
|
||
|
- "docker-compose.yml"
|
||
|
- "env.grafana.conf"
|
||
|
- "env.influxdb.conf"
|
||
|
tags:
|
||
|
- configuration
|
||
|
|
||
|
- name: Write datasource provisioning files
|
||
|
ansible.builtin.template:
|
||
|
src: "grafana-provisioning/datasources/{{ item }}.j2"
|
||
|
dest: "{{ grafana_setup_path | expanduser | realpath }}/grafana-provisioning/datasources/{{ item }}"
|
||
|
mode: '0640'
|
||
|
loop:
|
||
|
- "datasource.yml"
|
||
|
tags:
|
||
|
- configuration
|
||
|
|
||
|
|
||
|
- name: Ensure all requested components are running.
|
||
|
community.docker.docker_compose:
|
||
|
project_src: "{{ grafana_setup_path | expanduser | realpath }}"
|
||
|
build: false
|
||
|
become: true
|