2026-01-15 12:24:13 -08:00
|
|
|
---
|
|
|
|
|
# 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'
|
2026-01-16 19:33:02 -08:00
|
|
|
notify: Restart loki
|
2026-01-15 12:24:13 -08:00
|
|
|
|
|
|
|
|
- name: Ensure loki service is started
|
|
|
|
|
ansible.builtin.command: brew services start loki
|
2026-01-16 19:33:02 -08:00
|
|
|
register: loki_brew_start
|
|
|
|
|
changed_when: "'Successfully started' in loki_brew_start.stdout"
|
2026-01-15 12:24:13 -08:00
|
|
|
failed_when: false
|