Files
playbooks/monitoring/roles/loki/tasks/main.yaml
T
2026-10-18 21:35:52 +05:30

49 lines
1.3 KiB
YAML

---
# The image is configured to run by default as user loki with UID 10001 and GID 10001.
# You can use a different user, specially if you are using bind mounts, by specifying
# the UID with a docker run command and using --user=UID with a numeric UID suited to your needs.
# Tasks for Loki role
- name: Pull Loki image
docker_image:
name: "{{ loki_image }}"
source: pull
force_source: yes
- name: Ensure Loki Directory exists
file:
path: "{{ loki_directory }}"
state: directory
group: "{{ loki_user }}"
owner: "{{ loki_user }}"
mode: 0755
# - name: Ensure Loki Config Directory exists
# file:
# path: "{{ loki_directory }}/config"
# state: directory
# group: "{{ loki_user }}"
# owner: "{{ loki_user }}"
# mode: 0755
- name: Copy the Loki conf file
template:
src: "files/loki-config.yaml"
dest: "{{ loki_directory }}/loki-config.yaml"
group: "{{ loki_user }}"
owner: "{{ loki_user }}"
mode: 0644
- name: Create Loki container
docker_container:
name: "{{ loki_container }}"
image: "{{ loki_image }}"
state: started
restart_policy: "unless-stopped"
published_ports:
- "127.0.0.1:{{ loki_port }}:3100"
volumes:
- "{{ loki_directory }}:/mnt/config"
command:
- "-config.file=/mnt/config/loki-config.yaml"