first commit

This commit is contained in:
Alexander Gabriel 2022-11-29 18:58:41 +01:00
parent 39b5a5de32
commit a306c467e7
5 changed files with 96 additions and 0 deletions

1
files/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
loki-linux-amd64

7
handlers/main.yml Normal file
View File

@ -0,0 +1,7 @@
---
- name: restart loki
service:
daemon_reload: yes
name: loki
state: restarted

46
tasks/main.yml Normal file
View File

@ -0,0 +1,46 @@
---
- name: Create user loki
user:
name: loki
system: yes
group: root
- name: copy loki binaries
copy:
src: loki-linux-amd64
dest: /usr/local/bin/loki
owner: root
group: root
mode: '0755'
backup: no
- name: generate /etc/systemd/system/loki.service
template:
src: loki.service.j2
dest: /etc/systemd/system/loki.service
owner: root
group: root
mode: "0644"
notify:
- restart loki
- name: enable loki
systemd:
name: loki
enabled: yes
masked: no
notify:
- restart loki
- name: generate /etc/loki-local-config.yaml
template:
src: loki-local-config.yaml.j2
dest: /etc/loki.yaml
owner: root
group: root
mode: "0644"
notify:
- restart loki
- name: Flush handlers
meta: flush_handlers

View File

@ -0,0 +1,30 @@
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
common:
path_prefix: /tmp/loki
storage:
filesystem:
chunks_directory: /tmp/loki/chunks
rules_directory: /tmp/loki/rules
replication_factor: 1
ring:
instance_addr: 127.0.0.1
kvstore:
store: inmemory
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
ruler:
alertmanager_url: http://localhost:9093

12
templates/loki.service.j2 Normal file
View File

@ -0,0 +1,12 @@
[Unit]
Description=Loki service
After=network.target
[Service]
Type=simple
User=loki
ExecStart=/usr/local/bin/loki -config.file /etc/loki.yaml
[Install]
WantedBy=multi-user.target