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_auth_enabled
- loki_common_config
- loki_cpu_shares
- loki_default_folders
- loki_default_labels
- loki_default_publish
- loki_default_volumes
- loki_domain
- loki_extra_folders
- loki_extra_labels
- loki_extra_publish
- loki_extra_volumes
- loki_grpc_server_max_recv_msg_size
- loki_grpc_server_max_send_msg_size
- loki_image
- loki_ingester_config
- loki_limits_config
- loki_max_global_streams_per_user
- loki_max_streams_per_user
- 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_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_pull_image
- loki_retention_time
- loki_ruler_config
- loki_schema_config
- loki_server_config
- loki_storage_config
- loki_table_manager_config
- loki_version
- Discovered Tags
- Dependencies
- License
- Author
- Minimum Ansible version:
2.10
Enable authentication for Loki
loki_auth_enabled: false
Configuration block for common
loki_common_config: |
path_prefix: /loki
replication_factor: 1
ring:
kvstore:
store: inmemory
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/loki
List 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:3100
List of default volumes to mount for docker
loki_default_volumes:
- /var/lib/loki:/loki
- /etc/loki:/etc/loki
Domain for external access
loki_domain:
loki_domain: https://loki.example.com
List of extra folders to create
loki_extra_folders: []
loki_extra_folders:
- /path/to/host/folder1
- /path/to/host/folder2
- /path/to/host/folder3
List 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:3100
List 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/container3
Limit on the size of a gRPC message can receive
loki_grpc_server_max_recv_msg_size: 4194304
Limit on the size of a gRPC message can send
loki_grpc_server_max_send_msg_size: 4194304
Docker image to use for deployment on OAuth2 Proxy
loki_image: grafana/loki:{{ loki_version }}
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: 5000
Limits config for max streams per user
loki_max_streams_per_user: 0
Memory limit with Docker deployment
loki_memory_limit:
loki_memory_limit: 1024m
Soft memory limit with Docker deployment
loki_memory_soft_limit:
loki_memory_soft_limit: 512m
Swap usage with Docker deployment
loki_memory_swap:
loki_memory_swap: 2048m
Optional 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: false
List of groups to allow access
loki_oauth2_allowed_groups: []
loki_oauth2_allowed_groups:
- /Group1
- /Group2
- /Group3
Client 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:3099
List 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:3099
loki_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:3099
Memory limit with Docker deployment
loki_oauth2_memory_limit:
loki_oauth2_memory_limit: 1024m
Soft memory limit with Docker deployment
loki_oauth2_memory_soft_limit:
loki_oauth2_memory_soft_limit: 512m
Swap usage with Docker deployment
loki_oauth2_memory_swap:
loki_oauth2_memory_swap: 2048m
loki_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: keycloak
loki_oauth2_pull_image: true
Enable request logging for OAuth2 proxy
loki_oauth2_request_logging: false
List 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: p455w0rd
Upstream target for the OAuth2 proxy
loki_oauth2_upstream: http://loki:3100
Version of the OAuth2 Proxy to download
loki_oauth2_version: 7.7.1
Pull image as part of the tasks
loki_pull_image: true
Retention time to define the maximum age of the data
loki_retention_time: 30d
Configuration block for ruler
loki_ruler_config: |
storage:
type: local
local:
directory: /loki/rules
Configuration block for schema_config
loki_schema_config: |
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
Configuration 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/chunks
Configuration block for table_manager
loki_table_manager_config: |
retention_deletes_enabled: {{ "true" if loki_retention_time | default(False) else "false" }}
retention_period: {{ loki_retention_time }}
Version of the release to install
loki_version: 3.3.2
loki
oauth2
Apache-2.0