loki: flesh out role
This commit is contained in:
parent
45ddb507ef
commit
05b1e8da07
@ -26,12 +26,17 @@ loki_user_shell: /usr/sbin/nologin
|
||||
loki_group: loki
|
||||
loki_group_state: "{{ loki_user_state | default('present') }}"
|
||||
|
||||
loki_config_path: /etc/loki.yaml
|
||||
|
||||
loki_var_path: /var/lib/loki
|
||||
loki_var_owner: "{{ loki_user }}"
|
||||
loki_var_group: "{{ loki_group }}"
|
||||
loki_var_mode: "0755"
|
||||
loki_var_mode: "0700"
|
||||
|
||||
loki_etc_path: /etc/loki
|
||||
loki_etc_owner: "{{ loki_user }}"
|
||||
loki_etc_group: "{{ loki_group }}"
|
||||
loki_etc_mode: "0755"
|
||||
|
||||
loki_config_path: "{{ loki_etc_path }}/config.yaml"
|
||||
|
||||
loki_bin_path: /usr/local/bin
|
||||
|
||||
@ -39,36 +44,51 @@ loki_auth_enabled: false
|
||||
|
||||
loki_server:
|
||||
http_listen_port: 3100
|
||||
grpc_listen_port: 9096
|
||||
|
||||
loki_ingester:
|
||||
lifecycler:
|
||||
address: 127.0.0.1
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
replication_factor: 1
|
||||
final_sleep: 0s
|
||||
chunk_idle_period: 5m
|
||||
chunk_retain_period: 30s
|
||||
loki_common:
|
||||
instance_addr: 127.0.0.1
|
||||
path_prefix: "{{ loki_var_path }}"
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: "{{ loki_var_path }}/chunks"
|
||||
rules_directory: "{{ loki_var_path }}/rules"
|
||||
replication_factor: 1
|
||||
ring:
|
||||
kvstore:
|
||||
store: inmemory
|
||||
|
||||
loki_query_range:
|
||||
results_cache:
|
||||
cache:
|
||||
embedded_cache:
|
||||
enabled: true
|
||||
max_size_mb: 100
|
||||
|
||||
# loki_storage_config:
|
||||
# {}
|
||||
|
||||
loki_schema_config:
|
||||
configs:
|
||||
- from: 2020-05-15
|
||||
store: boltdb
|
||||
object_store: filesystem
|
||||
- from: 2020-10-24
|
||||
store: boltdb-shipper
|
||||
object_store: gcs
|
||||
schema: v11
|
||||
index:
|
||||
prefix: index_
|
||||
period: 168h
|
||||
period: 24h
|
||||
|
||||
loki_storage_config:
|
||||
boltdb:
|
||||
directory: "{{ loki_var_path }}/index"
|
||||
filesystem:
|
||||
directory: "{{ loki_var_path }}/chunks"
|
||||
loki_ruler:
|
||||
alertmanager_url: http://localhost:9093
|
||||
|
||||
# loki_query_scheduler:
|
||||
# {}
|
||||
|
||||
# loki_querier:
|
||||
# {}
|
||||
|
||||
# loki_compactor:
|
||||
# {}
|
||||
|
||||
loki_limits_config:
|
||||
enforce_metric_name: false
|
||||
reject_old_samples: true
|
||||
reject_old_samples_max_age: 168h
|
||||
ingestion_burst_size_mb: 16
|
||||
retention_period: 744h
|
@ -15,14 +15,13 @@
|
||||
home: "{{ loki_var_path }}"
|
||||
state: "{{ loki_user_state | default('present') }}"
|
||||
|
||||
- name: configure
|
||||
template:
|
||||
src: loki.yaml.j2
|
||||
dest: "{{ loki_config_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0444
|
||||
notify: restart loki
|
||||
- name: create etc path
|
||||
file:
|
||||
path: "{{ loki_etc_path }}"
|
||||
state: directory
|
||||
owner: "{{ loki_etc_owner }}"
|
||||
group: "{{ loki_etc_group }}"
|
||||
mode: "{{ loki_etc_mode }}"
|
||||
|
||||
- name: create var path
|
||||
file:
|
||||
@ -32,6 +31,15 @@
|
||||
group: "{{ loki_var_group }}"
|
||||
mode: "{{ loki_var_mode }}"
|
||||
|
||||
- name: configure
|
||||
template:
|
||||
src: config.yaml.j2
|
||||
dest: "{{ loki_config_path }}"
|
||||
owner: "{{ loki_user }}"
|
||||
group: "{{ loki_group }}"
|
||||
mode: 0400
|
||||
notify: restart loki
|
||||
|
||||
- name: configure systemd template
|
||||
template:
|
||||
src: "{{ loki_service_name }}.j2"
|
||||
|
55
roles/loki/templates/config.yaml.j2
Normal file
55
roles/loki/templates/config.yaml.j2
Normal file
@ -0,0 +1,55 @@
|
||||
{{ ansible_managed | comment }}
|
||||
---
|
||||
{% if loki_auth_enabled is defined %}
|
||||
auth_enabled: {{ loki_auth_enabled | bool | lower }}
|
||||
{% endif %}
|
||||
|
||||
{% if loki_server is defined %}
|
||||
server:
|
||||
{{ loki_server | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_common is defined %}
|
||||
common:
|
||||
{{ loki_common | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_query_range is defined %}
|
||||
query_range:
|
||||
{{ loki_query_range | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_storage_config is defined %}
|
||||
storage_config:
|
||||
{{ loki_storage_config | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_schema_config is defined %}
|
||||
schema_config:
|
||||
{{ loki_schema_config | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_ruler is defined %}
|
||||
ruler:
|
||||
{{ loki_ruler | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_query_scheduler is defined %}
|
||||
query_scheduler:
|
||||
{{ loki_query_scheduler | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_querier is defined %}
|
||||
querier:
|
||||
{{ loki_querier | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_compactor is defined %}
|
||||
compactor:
|
||||
{{ loki_compactor | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_limits_config is defined %}
|
||||
limits_config:
|
||||
{{ loki_limits_config | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
@ -1,19 +1,19 @@
|
||||
{{ ansible_managed | comment }}
|
||||
|
||||
[Unit]
|
||||
Description=Loki
|
||||
After=network-online.target
|
||||
Description=Loki service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ loki_user }}
|
||||
Group={{ loki_group }}
|
||||
ExecStart={{ loki_bin_path }}/loki \
|
||||
-config.file {{ loki_config_path }}
|
||||
WorkingDirectory={{ loki_var_path }}
|
||||
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
WorkingDirectory={{ loki_var_path }}
|
||||
TimeoutSec = 120
|
||||
Restart = on-failure
|
||||
RestartSec = 2
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,30 +0,0 @@
|
||||
{{ ansible_managed | comment }}
|
||||
---
|
||||
{% if loki_auth_enabled is defined %}
|
||||
auth_enabled: {{ loki_auth_enabled | bool | lower }}
|
||||
{% endif %}
|
||||
|
||||
{% if loki_server is defined %}
|
||||
server:
|
||||
{{ loki_server | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_ingester is defined %}
|
||||
ingester:
|
||||
{{ loki_ingester | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_schema_config is defined %}
|
||||
schema_config:
|
||||
{{ loki_schema_config | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_storage_config is defined %}
|
||||
storage_config:
|
||||
{{ loki_storage_config | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
||||
|
||||
{% if loki_limits_config is defined %}
|
||||
limits_config:
|
||||
{{ loki_limits_config | to_nice_yaml(indent=2) | indent(2, False) }}
|
||||
{% endif -%}
|
Loading…
Reference in New Issue
Block a user