blumeops/ansible/roles/grafana/tasks/main.yml
Erich Blume 4283f2237d Add grafana datasource provisioning and update workflow docs
- Configure grafana to use provisioned datasources instead of UI config
- Add prometheus datasource template managed by ansible
- Create minimal grafana.ini with custom provisioning path
- Move ansible_managed to group_vars (fixes deprecation warning)
- Add Remote Hosts and Git Workflow sections to CLAUDE.md
- Document feature branch workflow with tea CLI for PRs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 07:23:10 -08:00

35 lines
1,007 B
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: 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