blumeops/ansible/roles/grafana/tasks/main.yml
Erich Blume 7468023cd2 Add transmission dashboard to grafana
- Add node_exporter ansible role to enable textfile collector
- Add transmission_metrics role with script and LaunchAgent
  - Collects metrics every 60s via transmission RPC
  - Writes to /opt/homebrew/var/node_exporter/textfile/transmission.prom
- Update grafana role to provision dashboards from files
- Add transmission.json dashboard with:
  - Status indicator, torrent counts
  - Transfer speeds, cumulative stats
  - Time series graphs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 13:46:51 -08:00

49 lines
1.4 KiB
YAML

---
- name: Install grafana via homebrew
community.general.homebrew:
name: grafana
state: present
- name: Create grafana provisioning directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0755'
loop:
- /opt/homebrew/etc/grafana/provisioning
- /opt/homebrew/etc/grafana/provisioning/datasources
- /opt/homebrew/etc/grafana/provisioning/dashboards
- name: Configure grafana.ini
ansible.builtin.template:
src: grafana.ini.j2
dest: /opt/homebrew/etc/grafana/grafana.ini
mode: '0644'
notify: restart grafana
- name: Deploy grafana datasources config
ansible.builtin.template:
src: datasources.yaml.j2
dest: /opt/homebrew/etc/grafana/provisioning/datasources/datasources.yaml
mode: '0644'
notify: restart grafana
- name: Deploy grafana dashboards provider config
ansible.builtin.template:
src: dashboards.yaml.j2
dest: /opt/homebrew/etc/grafana/provisioning/dashboards/default.yaml
mode: '0644'
notify: restart grafana
- name: Deploy grafana dashboard JSON files
ansible.builtin.copy:
src: "dashboards/"
dest: /opt/homebrew/etc/grafana/provisioning/dashboards/
mode: '0644'
notify: restart grafana
- name: Ensure grafana service is started
ansible.builtin.command: brew services start grafana
register: brew_start
changed_when: "'Successfully started' in brew_start.stdout"
failed_when: false