Introduces pre-commit framework with hooks for: - General file hygiene (trailing whitespace, EOF, large files) - Secret detection (TruffleHog) - YAML linting (yamllint) - Ansible linting (ansible-lint) - Python linting/formatting (ruff) - Shell script analysis (shellcheck, shfmt) - TOML formatting (taplo) - JSON formatting (prettier) Fixes 91+ ansible-lint violations: - Renamed variables to use role prefixes (e.g., brew_start -> alloy_brew_start) - Capitalized handler names per convention - Added changed_when to command tasks - Fixed template usage in task names Fixes shellcheck warnings: - Removed unused variables - Fixed SC2155 (declare and assign separately) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
38 lines
943 B
YAML
38 lines
943 B
YAML
---
|
|
# Loki installation and configuration
|
|
|
|
- name: Install loki via homebrew
|
|
community.general.homebrew:
|
|
name: loki
|
|
state: present
|
|
|
|
- name: Ensure loki data directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ loki_data_dir }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Ensure loki chunks directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ loki_data_dir }}/chunks"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Ensure loki rules directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ loki_data_dir }}/rules"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Deploy loki configuration
|
|
ansible.builtin.template:
|
|
src: loki-config.yaml.j2
|
|
dest: "{{ loki_config_file }}"
|
|
mode: '0644'
|
|
notify: Restart loki
|
|
|
|
- name: Ensure loki service is started
|
|
ansible.builtin.command: brew services start loki
|
|
register: loki_brew_start
|
|
changed_when: "'Successfully started' in loki_brew_start.stdout"
|
|
failed_when: false
|