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>
34 lines
1 KiB
YAML
34 lines
1 KiB
YAML
---
|
|
# Note: borgmatic is installed via mise (pipx), not managed here.
|
|
# This role manages the config file and scheduled LaunchAgent.
|
|
|
|
- name: Ensure borgmatic config directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ borgmatic_config_dir }}"
|
|
state: directory
|
|
mode: '0700'
|
|
|
|
- name: Deploy borgmatic configuration
|
|
ansible.builtin.template:
|
|
src: config.yaml.j2
|
|
dest: "{{ borgmatic_config }}"
|
|
mode: '0600'
|
|
|
|
- name: Deploy borgmatic LaunchAgent plist
|
|
ansible.builtin.template:
|
|
src: borgmatic.plist.j2
|
|
dest: ~/Library/LaunchAgents/mcquack.eblume.borgmatic.plist
|
|
mode: '0644'
|
|
notify: Reload borgmatic
|
|
|
|
- name: Check if borgmatic LaunchAgent is loaded
|
|
ansible.builtin.command: launchctl list mcquack.eblume.borgmatic
|
|
register: borgmatic_launchctl_check
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Load borgmatic LaunchAgent if not loaded
|
|
ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.eblume.borgmatic.plist
|
|
when: borgmatic_launchctl_check.rc != 0
|
|
changed_when: true
|
|
failed_when: false
|