mirror of
https://github.com/RWejlgaard/pez-infra.git
synced 2026-05-06 04:14:43 +00:00
54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
---
|
|
# Install and configure Grafana Loki on FreeBSD (london-a).
|
|
# Co-located with Prometheus and Grafana; all three run as native FreeBSD services.
|
|
# FreeBSD only — Loki is the log aggregation backend for Promtail on all hosts.
|
|
|
|
- name: Install loki (FreeBSD)
|
|
community.general.pkgng:
|
|
name: grafana-loki
|
|
state: present
|
|
when: ansible_facts["os_family"] == "FreeBSD"
|
|
|
|
- name: Ensure Loki data directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ loki_data_dir }}"
|
|
state: directory
|
|
mode: '0755'
|
|
owner: loki
|
|
group: loki
|
|
when: ansible_facts["os_family"] == "FreeBSD"
|
|
|
|
- name: Ensure Loki config directory exists
|
|
ansible.builtin.file:
|
|
path: /usr/local/etc/loki
|
|
state: directory
|
|
mode: '0755'
|
|
when: ansible_facts["os_family"] == "FreeBSD"
|
|
|
|
- name: Deploy Loki config
|
|
ansible.builtin.template:
|
|
src: loki.yml.j2
|
|
dest: /usr/local/etc/loki/config.yml
|
|
mode: '0644'
|
|
owner: root
|
|
group: wheel
|
|
when: ansible_facts["os_family"] == "FreeBSD"
|
|
notify: Restart loki
|
|
|
|
- name: Enable loki (FreeBSD)
|
|
community.general.sysrc:
|
|
name: loki_enable
|
|
value: "YES"
|
|
when: ansible_facts["os_family"] == "FreeBSD"
|
|
|
|
- name: Set loki config path in rc.conf (FreeBSD)
|
|
community.general.sysrc:
|
|
name: loki_config
|
|
value: /usr/local/etc/loki/config.yml
|
|
when: ansible_facts["os_family"] == "FreeBSD"
|
|
|
|
- name: Start loki (FreeBSD)
|
|
ansible.builtin.service:
|
|
name: loki
|
|
state: started
|
|
when: ansible_facts["os_family"] == "FreeBSD"
|