2026-01-13 21:12:24 -08:00
|
|
|
---
|
|
|
|
|
- name: Install grafana via homebrew
|
|
|
|
|
community.general.homebrew:
|
|
|
|
|
name: grafana
|
|
|
|
|
state: present
|
|
|
|
|
|
2026-01-14 07:20:11 -08:00
|
|
|
- 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'
|
2026-01-16 19:33:02 -08:00
|
|
|
notify: Restart grafana
|
2026-01-14 07:20:11 -08:00
|
|
|
|
|
|
|
|
- name: Deploy grafana datasources config
|
|
|
|
|
ansible.builtin.template:
|
|
|
|
|
src: datasources.yaml.j2
|
|
|
|
|
dest: /opt/homebrew/etc/grafana/provisioning/datasources/datasources.yaml
|
|
|
|
|
mode: '0644'
|
2026-01-16 19:33:02 -08:00
|
|
|
notify: Restart grafana
|
2026-01-14 07:20:11 -08:00
|
|
|
|
2026-01-14 13:46:51 -08:00
|
|
|
- name: Deploy grafana dashboards provider config
|
|
|
|
|
ansible.builtin.template:
|
|
|
|
|
src: dashboards.yaml.j2
|
|
|
|
|
dest: /opt/homebrew/etc/grafana/provisioning/dashboards/default.yaml
|
|
|
|
|
mode: '0644'
|
2026-01-16 19:33:02 -08:00
|
|
|
notify: Restart grafana
|
2026-01-14 13:46:51 -08:00
|
|
|
|
|
|
|
|
- name: Deploy grafana dashboard JSON files
|
|
|
|
|
ansible.builtin.copy:
|
|
|
|
|
src: "dashboards/"
|
|
|
|
|
dest: /opt/homebrew/etc/grafana/provisioning/dashboards/
|
|
|
|
|
mode: '0644'
|
2026-01-16 19:33:02 -08:00
|
|
|
notify: Restart grafana
|
2026-01-14 13:46:51 -08:00
|
|
|
|
2026-01-13 21:12:24 -08:00
|
|
|
- name: Ensure grafana service is started
|
|
|
|
|
ansible.builtin.command: brew services start grafana
|
2026-01-16 19:33:02 -08:00
|
|
|
register: grafana_brew_start
|
|
|
|
|
changed_when: "'Successfully started' in grafana_brew_start.stdout"
|
2026-01-13 21:12:24 -08:00
|
|
|
failed_when: false
|