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: loki
|
||||||
loki_group_state: "{{ loki_user_state | default('present') }}"
|
loki_group_state: "{{ loki_user_state | default('present') }}"
|
||||||
|
|
||||||
loki_config_path: /etc/loki.yaml
|
|
||||||
|
|
||||||
loki_var_path: /var/lib/loki
|
loki_var_path: /var/lib/loki
|
||||||
loki_var_owner: "{{ loki_user }}"
|
loki_var_owner: "{{ loki_user }}"
|
||||||
loki_var_group: "{{ loki_group }}"
|
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
|
loki_bin_path: /usr/local/bin
|
||||||
|
|
||||||
@ -39,36 +44,51 @@ loki_auth_enabled: false
|
|||||||
|
|
||||||
loki_server:
|
loki_server:
|
||||||
http_listen_port: 3100
|
http_listen_port: 3100
|
||||||
|
grpc_listen_port: 9096
|
||||||
|
|
||||||
loki_ingester:
|
loki_common:
|
||||||
lifecycler:
|
instance_addr: 127.0.0.1
|
||||||
address: 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:
|
ring:
|
||||||
kvstore:
|
kvstore:
|
||||||
store: inmemory
|
store: inmemory
|
||||||
replication_factor: 1
|
|
||||||
final_sleep: 0s
|
loki_query_range:
|
||||||
chunk_idle_period: 5m
|
results_cache:
|
||||||
chunk_retain_period: 30s
|
cache:
|
||||||
|
embedded_cache:
|
||||||
|
enabled: true
|
||||||
|
max_size_mb: 100
|
||||||
|
|
||||||
|
# loki_storage_config:
|
||||||
|
# {}
|
||||||
|
|
||||||
loki_schema_config:
|
loki_schema_config:
|
||||||
configs:
|
configs:
|
||||||
- from: 2020-05-15
|
- from: 2020-10-24
|
||||||
store: boltdb
|
store: boltdb-shipper
|
||||||
object_store: filesystem
|
object_store: gcs
|
||||||
schema: v11
|
schema: v11
|
||||||
index:
|
index:
|
||||||
prefix: index_
|
prefix: index_
|
||||||
period: 168h
|
period: 24h
|
||||||
|
|
||||||
loki_storage_config:
|
loki_ruler:
|
||||||
boltdb:
|
alertmanager_url: http://localhost:9093
|
||||||
directory: "{{ loki_var_path }}/index"
|
|
||||||
filesystem:
|
# loki_query_scheduler:
|
||||||
directory: "{{ loki_var_path }}/chunks"
|
# {}
|
||||||
|
|
||||||
|
# loki_querier:
|
||||||
|
# {}
|
||||||
|
|
||||||
|
# loki_compactor:
|
||||||
|
# {}
|
||||||
|
|
||||||
loki_limits_config:
|
loki_limits_config:
|
||||||
enforce_metric_name: false
|
retention_period: 744h
|
||||||
reject_old_samples: true
|
|
||||||
reject_old_samples_max_age: 168h
|
|
||||||
ingestion_burst_size_mb: 16
|
|
@ -15,14 +15,13 @@
|
|||||||
home: "{{ loki_var_path }}"
|
home: "{{ loki_var_path }}"
|
||||||
state: "{{ loki_user_state | default('present') }}"
|
state: "{{ loki_user_state | default('present') }}"
|
||||||
|
|
||||||
- name: configure
|
- name: create etc path
|
||||||
template:
|
file:
|
||||||
src: loki.yaml.j2
|
path: "{{ loki_etc_path }}"
|
||||||
dest: "{{ loki_config_path }}"
|
state: directory
|
||||||
owner: root
|
owner: "{{ loki_etc_owner }}"
|
||||||
group: root
|
group: "{{ loki_etc_group }}"
|
||||||
mode: 0444
|
mode: "{{ loki_etc_mode }}"
|
||||||
notify: restart loki
|
|
||||||
|
|
||||||
- name: create var path
|
- name: create var path
|
||||||
file:
|
file:
|
||||||
@ -32,6 +31,15 @@
|
|||||||
group: "{{ loki_var_group }}"
|
group: "{{ loki_var_group }}"
|
||||||
mode: "{{ loki_var_mode }}"
|
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
|
- name: configure systemd template
|
||||||
template:
|
template:
|
||||||
src: "{{ loki_service_name }}.j2"
|
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 }}
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Loki
|
Description=Loki service
|
||||||
After=network-online.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User={{ loki_user }}
|
User={{ loki_user }}
|
||||||
Group={{ loki_group }}
|
|
||||||
ExecStart={{ loki_bin_path }}/loki \
|
ExecStart={{ loki_bin_path }}/loki \
|
||||||
-config.file {{ loki_config_path }}
|
-config.file {{ loki_config_path }}
|
||||||
WorkingDirectory={{ loki_var_path }}
|
|
||||||
|
|
||||||
Restart=always
|
WorkingDirectory={{ loki_var_path }}
|
||||||
RestartSec=1
|
TimeoutSec = 120
|
||||||
|
Restart = on-failure
|
||||||
|
RestartSec = 2
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
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