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>
32 lines
1,004 B
YAML
32 lines
1,004 B
YAML
---
|
|
- name: Ensure bin directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ plex_metrics_script | dirname }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Deploy plex metrics collection script
|
|
ansible.builtin.template:
|
|
src: plex-metrics.sh.j2
|
|
dest: "{{ plex_metrics_script }}"
|
|
mode: '0755'
|
|
notify: Reload plex-metrics
|
|
|
|
- name: Deploy plex-metrics LaunchAgent plist
|
|
ansible.builtin.template:
|
|
src: plex-metrics.plist.j2
|
|
dest: ~/Library/LaunchAgents/mcquack.eblume.plex-metrics.plist
|
|
mode: '0644'
|
|
notify: Reload plex-metrics
|
|
|
|
- name: Check if plex-metrics LaunchAgent is loaded
|
|
ansible.builtin.command: launchctl list mcquack.eblume.plex-metrics
|
|
register: plex_metrics_launchctl_check
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Load plex-metrics LaunchAgent if not loaded
|
|
ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.eblume.plex-metrics.plist
|
|
when: plex_metrics_launchctl_check.rc != 0
|
|
changed_when: true
|
|
failed_when: false
|