## Summary - Use async with poll: 0 for alloy and loki restart handlers - Fire-and-forget approach prevents ansible from hanging on graceful shutdown ## Test plan - [x] Manually verified `brew services restart grafana-alloy` works - [x] Run full ansible playbook and verify it completes without timeout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: https://forge.tail8d86e.ts.net/eblume/blumeops/pulls/12
39 lines
1 KiB
YAML
39 lines
1 KiB
YAML
---
|
|
# Grafana Alloy installation and configuration
|
|
# Replaces node_exporter for metrics, adds log collection
|
|
|
|
- name: Install grafana-alloy via homebrew
|
|
community.general.homebrew:
|
|
name: grafana-alloy
|
|
state: present
|
|
|
|
- name: Ensure alloy config directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ alloy_config_dir }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Ensure alloy data directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ alloy_data_dir }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Ensure textfile collector directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ alloy_textfile_dir }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Deploy alloy configuration
|
|
ansible.builtin.template:
|
|
src: config.alloy.j2
|
|
dest: "{{ alloy_config_dir }}/config.alloy"
|
|
mode: '0644'
|
|
notify: restart alloy
|
|
|
|
- name: Ensure alloy service is started
|
|
ansible.builtin.command: brew services start grafana-alloy
|
|
register: brew_start
|
|
changed_when: "'Successfully started' in brew_start.stdout"
|
|
failed_when: false
|