Ansible role to install and configure loki.
Building and improving this Ansible role have been sponsored by my current and previous employers like Cloudpunks GmbH and Proact Deutschland GmbH.
- Requirements
- Default Variables
- loki_additional_config
- loki_auth_enabled
- loki_chunk_store_config
- loki_combined_config
- loki_common_config
- loki_compactor_config
- loki_cpu_shares
- loki_default_folders
- loki_default_labels
- loki_default_publish
- loki_default_volumes
- loki_distributor_config
- loki_domain
- loki_extra_folders
- loki_extra_labels
- loki_extra_publish
- loki_extra_volumes
- loki_frontend_worker_config
- loki_grpc_server_max_recv_msg_size
- loki_grpc_server_max_send_msg_size
- loki_image
- loki_index_gateway_config
- loki_ingester_client_config
- loki_ingester_config
- loki_limits_config
- loki_max_global_streams_per_user
- loki_max_streams_per_user
- loki_memberlist_config
- loki_memory_limit
- loki_memory_soft_limit
- loki_memory_swap
- loki_network
- loki_number_of_cpus
- loki_oauth2_access_logging
- loki_oauth2_allowed_groups
- loki_oauth2_client_id
- loki_oauth2_client_secret
- loki_oauth2_cookie_secret
- loki_oauth2_cpu_shares
- loki_oauth2_default_labels
- loki_oauth2_default_publish
- loki_oauth2_enabled
- loki_oauth2_extra_labels
- loki_oauth2_extra_publish
- loki_oauth2_image
- loki_oauth2_keycloak_url
- loki_oauth2_listen_address
- loki_oauth2_memory_limit
- loki_oauth2_memory_soft_limit
- loki_oauth2_memory_swap
- loki_oauth2_network
- loki_oauth2_number_of_cpus
- loki_oauth2_provider
- loki_oauth2_pull_image
- loki_oauth2_request_logging
- loki_oauth2_static_groups
- loki_oauth2_static_users
- loki_oauth2_upstream
- loki_oauth2_version
- loki_pattern_ingester_config
- loki_pull_image
- loki_querier_config
- loki_query_scheduler_config
- loki_retention_time
- loki_ruler_config
- loki_ruler_storage_config
- loki_schema_config
- loki_server_config
- loki_storage_config
- loki_table_manager_config
- loki_ui_config
- loki_version
- Discovered Tags
- Dependencies
- License
- Author
- Minimum Ansible version:
2.10
Additional optional config to append
loki_additional_config:Enable authentication for Loki
loki_auth_enabled: falseConfiguration block for chunk_store_config
loki_chunk_store_config:Final combined config writte to file
loki_combined_config: |
auth_enabled: {{ loki_auth_enabled | lower }}
{% if loki_server_config is not none and loki_server_config | length > 0 %}
server:
{{ loki_server_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_ui_config is not none and loki_ui_config | length > 0 %}
ui:
{{ loki_ui_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_distributor_config is not none and loki_distributor_config | length > 0 %}
distributor:
{{ loki_distributor_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_querier_config is not none and loki_querier_config | length > 0 %}
querier:
{{ loki_querier_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_query_scheduler_config is not none and loki_query_scheduler_config | length > 0 %}
query_scheduler:
{{ loki_query_scheduler_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_ruler_config is not none and loki_ruler_config | length > 0 %}
ruler:
{{ loki_ruler_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_ruler_storage_config is not none and loki_ruler_storage_config | length > 0 %}
ruler_storage:
{{ loki_ruler_storage_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_ingester_client_config is not none and loki_ingester_client_config | length > 0 %}
ingester_client:
{{ loki_ingester_client_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_ingester_config is not none and loki_ingester_config | length > 0 %}
ingester:
{{ loki_ingester_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_pattern_ingester_config is not none and loki_pattern_ingester_config | length > 0 %}
pattern_ingester:
{{ loki_pattern_ingester_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_index_gateway_config is not none and loki_index_gateway_config | length > 0 %}
index_gateway:
{{ loki_index_gateway_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_storage_config is not none and loki_storage_config | length > 0 %}
storage_config:
{{ loki_storage_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_chunk_store_config is not none and loki_chunk_store_config | length > 0 %}
chunk_store_config:
{{ loki_chunk_store_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_schema_config is not none and loki_schema_config | length > 0 %}
schema_config:
{{ loki_schema_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_compactor_config is not none and loki_compactor_config | length > 0 %}
compactor:
{{ loki_compactor_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_limits_config is not none and loki_limits_config | length > 0 %}
limits_config:
{{ loki_limits_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_frontend_worker_config is not none and loki_frontend_worker_config | length > 0 %}
frontend_worker_config:
{{ loki_frontend_worker_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_table_manager_config is not none and loki_table_manager_config | length > 0 %}
table_manager:
{{ loki_table_manager_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_memberlist_config is not none and loki_memberlist_config | length > 0 %}
memberlist:
{{ loki_memberlist_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_common_config is not none and loki_common_config | length > 0 %}
common:
{{ loki_common_config | from_yaml | to_nice_yaml(indent=2) | indent(width=2) | trim }}
{% endif %}
{% if loki_additional_config is not none and loki_additional_config | length > 0 %}
{{ loki_additional_config | from_yaml | to_nice_yaml(indent=2) | trim }}
{% endif %}Configuration block for common
loki_common_config: |
path_prefix: /loki
replication_factor: 1
ring:
kvstore:
store: inmemoryConfiguration block for compactor
loki_compactor_config:CPU shares with Docker deployment
loki_cpu_shares:loki_cpu_shares: '512'List of default folders to create
loki_default_folders:
- /etc/loki
- /var/lib/lokiList of default labels to assign to docker
loki_default_labels: []List of default port publishing for docker
loki_default_publish: []loki_default_publish:
- 127.0.0.1:3100:3100List of default volumes to mount for docker
loki_default_volumes:
- /var/lib/loki:/loki
- /etc/loki:/etc/lokiConfiguration block for distributor
loki_distributor_config:Domain for external access
loki_domain:loki_domain: https://loki.example.comList of extra folders to create
loki_extra_folders: []loki_extra_folders:
- /path/to/host/folder1
- /path/to/host/folder2
- /path/to/host/folder3List of extra labels to assign to docker
loki_extra_labels: []List of extra port publishing for docker
loki_extra_publish: []loki_extra_publish:
- 127.0.0.1:3100:3100List of extra volumes to mount for docker
loki_extra_volumes: []loki_extra_volumes:
- /path/to/host/folder1:/path/within/container1
- /path/to/host/folder2:/path/within/container2
- /path/to/host/folder3:/path/within/container3Configuration block for frontend_worker
loki_frontend_worker_config:Limit on the size of a gRPC message can receive
loki_grpc_server_max_recv_msg_size: 4194304Limit on the size of a gRPC message can send
loki_grpc_server_max_send_msg_size: 4194304Docker image to use for deployment on OAuth2 Proxy
loki_image: grafana/loki:{{ loki_version }}Configuration block for index_gateway
loki_index_gateway_config:Configuration block for ingester_client
loki_ingester_client_config:Configuration block for ingester
loki_ingester_config:Configuration block for limits
loki_limits_config: |
max_streams_per_user: {{ loki_max_streams_per_user }}
max_global_streams_per_user: {{ loki_max_global_streams_per_user }}Limits config for max global streams per user
loki_max_global_streams_per_user: 5000Limits config for max streams per user
loki_max_streams_per_user: 0Configuration block for memberlist
loki_memberlist_config:Memory limit with Docker deployment
loki_memory_limit:loki_memory_limit: 1024mSoft memory limit with Docker deployment
loki_memory_soft_limit:loki_memory_soft_limit: 512mSwap usage with Docker deployment
loki_memory_swap:loki_memory_swap: 2048mOptional docker network to attach on OAuth2 Proxy
loki_network:Number of CPUs with Docker deployment
loki_number_of_cpus:loki_number_of_cpus: '1.0'Enable access logging for OAuth2 proxy
loki_oauth2_access_logging: falseList of groups to allow access
loki_oauth2_allowed_groups: []loki_oauth2_allowed_groups:
- /Group1
- /Group2
- /Group3Client ID for OAuth2 authentication
loki_oauth2_client_id:Client secret for OAuth2 authentication
loki_oauth2_client_secret:Cookie secret used by OAuth2 proxy
loki_oauth2_cookie_secret:CPU shares with Docker deployment
loki_oauth2_cpu_shares:loki_oauth2_cpu_shares: '512'List of default labels to assign to docker on OAuth2 Proxy
loki_oauth2_default_labels: []List of default port publishing for docker on OAuth2 Proxy
loki_oauth2_default_publish: []loki_oauth2_default_publish:
- 127.0.0.1:3099:3099Enable authentication for Loki
loki_oauth2_enabled: falseList of extra labels to assign to docker on OAuth2 Proxy
loki_oauth2_extra_labels: []List of extra port publishing for docker on OAuth2 Proxy
loki_oauth2_extra_publish: []loki_oauth2_extra_publish:
- 127.0.0.1:3099:3099loki_oauth2_image: quay.io/oauth2-proxy/oauth2-proxy:v{{ loki_oauth2_version }}URL of the Keycloak realm
loki_oauth2_keycloak_url:Listem address for the OAuth2 proxy
loki_oauth2_listen_address: 0.0.0.0:3099Memory limit with Docker deployment
loki_oauth2_memory_limit:loki_oauth2_memory_limit: 1024mSoft memory limit with Docker deployment
loki_oauth2_memory_soft_limit:loki_oauth2_memory_soft_limit: 512mSwap usage with Docker deployment
loki_oauth2_memory_swap:loki_oauth2_memory_swap: 2048mloki_oauth2_network: '{{ loki_network }}'Number of CPUs with Docker deployment
loki_oauth2_number_of_cpus:loki_oauth2_number_of_cpus: '1.0'Provider for OAuth2 authentication
loki_oauth2_provider: keycloakloki_oauth2_pull_image: trueEnable request logging for OAuth2 proxy
loki_oauth2_request_logging: falseList of groups assigned to static users
loki_oauth2_static_groups: []List of users to allow access
loki_oauth2_static_users: []loki_oauth2_static_users:
- username: username1
password: p455w0rd
- username: username2
password: p455w0rd
- username: username3
password: p455w0rdUpstream target for the OAuth2 proxy
loki_oauth2_upstream: http://loki:3100Version of the OAuth2 Proxy to download
loki_oauth2_version: 7.14.2Configuration block for pattern_ingester
loki_pattern_ingester_config:Pull image as part of the tasks
loki_pull_image: trueConfiguration block for querier
loki_querier_config:Configuration block for query_scheduler
loki_query_scheduler_config:Retention time to define the maximum age of the data
loki_retention_time: 30dConfiguration block for ruler
loki_ruler_config:Configuration block for ruler_storage
loki_ruler_storage_config: |
backend: local
local:
directory: /loki/rulesConfiguration block for schema_config
loki_schema_config: |
configs:
- from: 2020-10-24
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h
chunks:
prefix: chunks_
period: 24hConfiguration block for server
loki_server_config: |
http_listen_port: 3100
grpc_server_max_recv_msg_size: {{ loki_grpc_server_max_recv_msg_size }}
grpc_server_max_send_msg_size: {{ loki_grpc_server_max_send_msg_size }}Configuration block for storage_config
loki_storage_config: |
filesystem:
directory: /loki/chunksConfiguration block for table_manager
loki_table_manager_config: |
retention_deletes_enabled: {{ "true" if loki_retention_time is not none and loki_retention_time | length > 0 else "false" }}
retention_period: {{ loki_retention_time }}Configuration block for ui
loki_ui_config:Version of the release to install
loki_version: 3.6.6loki
oauth2
Apache-2.0