blumeops/ansible/roles/grafana/tasks/main.yml
Erich Blume 9931829d03 Add pre-commit hooks for code quality (#19)
## Summary
- Add pre-commit framework with hooks for YAML, Ansible, Python, shell, TOML, JSON, and secret detection
- Fix all 91+ ansible-lint violations (variable naming, handler capitalization, changed_when)
- Fix shellcheck warnings in mise-tasks scripts
- Document pre-commit setup in README.md

## Deployment and Testing
- [x] All pre-commit hooks pass (`uvx pre-commit run --all-files`)
- [x] Test ansible playbook with `--check` mode
- [x] Run `mise run indri-services-check` after deploy

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: https://forge.tail8d86e.ts.net/eblume/blumeops/pulls/19
2026-01-16 19:33:02 -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: grafana_brew_start
changed_when: "'Successfully started' in grafana_brew_start.stdout"
failed_when: false