### Install OpenTelemetry Collector with Custom Configuration Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/opentelemetry_collector/README.md Example playbook demonstrating how to include the OpenTelemetry Collector role and configure its components. This includes setting up receivers, processors, exporters, extensions, and service pipelines. ```yaml - name: Install OpenTelemetry Collector hosts: all become: true tasks: - name: Install OpenTelemetry Collector ansible.builtin.include_role: name: grafana.grafana.opentelemetry_collector vars: otel_collector_receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318 otel_collector_processors: batch: otel_collector_exporters: otlp: endpoint: otelcol:4317 otel_collector_extensions: health_check: pprof: zpages: otel_collector_service: extensions: [health_check, pprof, zpages] pipelines: traces: receivers: [otlp] processors: [batch] exporters: [otlp] metrics: receivers: [otlp] processors: [batch] exporters: [otlp] logs: receivers: [otlp] processors: [batch] exporters: [otlp] ``` -------------------------------- ### Execute Loki Playbook Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Examples for executing the Loki playbook. Use the first command for deployment and the second with 'loki_uninstall=true' for uninstallation. ```shell # Deployment ansible-playbook -i inventory/hosts playbook/function_loki_play.yml ``` ```shell # Uninstall ansible-playbook -i inventory/hosts playbook/function_loki_play.yml -e "loki_uninstall=true" ``` -------------------------------- ### OpenTelemetry Collector Configuration Example Source: https://github.com/grafana/grafana-ansible-collection/blob/main/examples/monitor-multiple-instance-otel.md This is a basic example configuration for the OpenTelemetry Collector, designed for collecting traces, logs, and metrics via OTLP and forwarding them to Grafana Cloud. Adjust the receivers, processors, and exporters to match your specific telemetry data and destination. ```yaml logs: receivers: [otlp] processors: [resourcedetection, batch] exporters: [loki/grafana_cloud_logs] ``` -------------------------------- ### Import Grafana Dashboard Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/grafana/README.md Example of how to specify a dashboard to be imported into Grafana. The 'grafana_dashboards' variable should be a list of dashboard configurations. ```yaml grafana_dashboards: - dashboard_id: 111 revision_id: 1 datasource: prometheus ``` -------------------------------- ### Install Dependencies for Molecule Testing Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/mimir/README.md Installs necessary Python packages for Ansible, Molecule, and testing utilities. Ensure your virtual environment is activated before running this command. ```bash pip3 install ansible-core==2.16 'molecule-plugins[docker]' pytest-testinfra jmespath selinux passlib ``` -------------------------------- ### Ansible Inventory File Example Source: https://github.com/grafana/grafana-ansible-collection/blob/main/examples/monitor-multiple-instances-agent.md Defines the target Linux hosts for Ansible automation. Each IP address corresponds to a host, with optional hostnames as comments. Remove comments before use. ```ini 146.190.208.216 # hostname = ubuntu-01 146.190.208.190 # hostname = ubuntu-02 137.184.155.128 # hostname = centos-01 146.190.216.129 # hostname = centos-02 198.199.82.174 # hostname = debian-01 198.199.77.93 # hostname = debian-02 143.198.182.156 # hostname = fedora-01 143.244.174.246 # hostname = fedora-02 ``` -------------------------------- ### Create Grafana Cloud Stack using FQCN Source: https://github.com/grafana/grafana-ansible-collection/blob/main/README.md Example of creating a Grafana Cloud stack using the `grafana.grafana.cloud_stack` module with its Fully Qualified Collection Namespace (FQCN). Ensure `cloud_api_key` is securely managed. ```yaml - name: Using grafana collection hosts: localhost tasks: - name: Create a Grafana Cloud stack grafana.grafana.cloud_stack: name: mystack stack_slug: mystack org_slug: myorg cloud_api_key: "{{ cloud_api_key }}" region: eu state: present ``` -------------------------------- ### Create Grafana Cloud Stack with Collection Included Source: https://github.com/grafana/grafana-ansible-collection/blob/main/README.md Example of creating a Grafana Cloud stack after including the `grafana.grafana` collection in the playbook's `collections` element. This allows calling modules directly by their short name. ```yaml - name: Using grafana collection hosts: localhost collection: - grafana.grafana tasks: - name: Create a Grafana Cloud stack cloud_stack: name: mystack stack_slug: mystack org_slug: myorg cloud_api_key: "{{ cloud_api_key }}" region: eu state: present ``` -------------------------------- ### Configure Promtail Clients Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md The `clients` block configures how Promtail connects to Loki instances. This configuration is mandatory. The example shows a basic connection to a local Loki instance. ```yaml promtail_clients: - url: http://localhost:3100/loki/api/v1/push ``` -------------------------------- ### Configure and Deploy Promtail Service with Ansible Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md This playbook configures Promtail clients and scrape jobs. Ensure Promtail is installed via the 'grafana.grafana.promtail' role. ```yaml - name: Manage promtail service hosts: all become: true vars: promtail_clients: - url: http://localhost:3100/loki/api/v1/push promtail_scrape_configs: - job_name: system static_configs: - targets: - localhost labels: job: messages instance: "{{ ansible_facts['fqdn'] }}" __path__: /var/log/messages - targets: - localhost labels: job: nginx instance: "{{ ansible_facts['fqdn'] }}" __path__: /var/log/nginx/*.log roles: - role: grafana.grafana.promtail ``` -------------------------------- ### Install Grafana Ansible Collection Source: https://github.com/grafana/grafana-ansible-collection/blob/main/README.md Install the Grafana Ansible collection using ansible-galaxy. This command fetches and installs the latest version of the collection. ```shell ansible-galaxy collection install grafana.grafana ``` -------------------------------- ### Install Grafana Ansible Collection Source: https://github.com/grafana/grafana-ansible-collection/blob/main/examples/monitor-multiple-instances-agent.md Installs the Grafana Ansible collection, which includes the grafana_agent role. Ensure you are using version 2.0.0 or later. ```bash ansible-galaxy collection install grafana.grafana:2.0.0 ``` -------------------------------- ### Example Loki Alerting Rules Configuration Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md This snippet shows how to define multiple alerting rules for Loki, including rules for Nextcloud login failures and SSH login failures. It demonstrates the structure for alert expressions, durations, labels, and annotations. ```yaml --- loki_ruler_alerts: - name: Logs.Nextcloud rules: - alert: NextcloudLoginFailed expr: | count by (filename,env,job) (count_over_time({job=~"nextcloud"} | json | message=~"Login failed.*" [10m])) > 4 for: 0m labels: severity: critical annotations: summary: "{% raw %}On {{ $labels.job }} in log {{ $labels.filename }} failed login detected.{% endraw %}" - name: Logs.sshd rules: - alert: SshLoginFailed expr: | count_over_time({job=~"secure"} |="sshd[" |~": Failed|: Invalid|: Connection closed by authenticating user" | __error__="" [15m]) > 15 for: 0m labels: severity: critical annotations: summary: "{% raw %}SSH authentication failure (instance {{ $labels.instance }}).{% endraw %}" ``` -------------------------------- ### Manage Alloy Service with Ansible Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/alloy/README.md This playbook demonstrates how to manage the Alloy service using the Grafana Alloy Ansible role. It includes examples for both deployment and uninstallation. ```yaml - name: Manage alloy service hosts: all become: true vars: # alloy_config: | # Your Config Content roles: - role: grafana.grafana.alloy ``` -------------------------------- ### Configure Grafana Datasource Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/grafana/README.md Example of how to configure a Prometheus datasource for Grafana. Ensure the 'grafana_datasources' variable is set to a list of datasource configurations. ```yaml grafana_datasources: - name: prometheus type: prometheus access: proxy url: 'http://{{ prometheus_web_listen_address }}' basicAuth: false ``` -------------------------------- ### Install Grafana Agent with Ansible Role Source: https://github.com/grafana/grafana-ansible-collection/blob/main/examples/monitor-multiple-instances-agent.md This playbook installs the Grafana Agent using the `grafana.grafana.grafana_agent` role. It configures metrics and logs to be sent to specified Prometheus and Loki endpoints using Grafana Cloud API keys and usernames. Ensure you replace placeholder values with your actual credentials and URLs. ```yaml - name: Install Grafana Agent hosts: all become: true vars: grafana_cloud_api_key: # Example - eyJrIjoiYjI3NjI5MGQxZTcyOTIxYTc0MDgzMGVhNDhlODNhYzA5OTk2Y2U5YiIsIm4iOiJhbnNpYmxldGVzdCIsImlkIjo2NTI5 metrics_username: # Example - 825019 logs_username: # Example - 411478 prometheus_url: # Example - https://prometheus-us-central1.grafana.net/api/prom/push loki_url: # Example - https://logs-prod-017.grafana.net/loki/api/v1/push tasks: - name: Install Grafana Agent ansible.builtin.include_role: name: grafana.grafana.grafana_agent vars: grafana_agent_metrics_config: configs: - name: integrations remote_write: - basic_auth: password: "{{ grafana_cloud_api_key }}" username: "{{ metrics_username }}" url: "{{ prometheus_url }}" global: scrape_interval: 60s wal_directory: /tmp/grafana-agent-wal grafana_agent_logs_config: configs: - name: default clients: - basic_auth: password: "{{ grafana_cloud_api_key }}" username: "{{ logs_username }}" url: "{{ loki_url }}" positions: filename: /tmp/positions.yaml target_config: sync_period: 10s scrape_configs: - job_name: varlogs static_configs: - targets: [localhost] labels: instance: ${HOSTNAME:-default} job: varlogs __path__: /var/log/*log grafana_agent_integrations_config: node_exporter: enabled: true instance: ${HOSTNAME:-default} prometheus_remote_write: - basic_auth: password: "{{ grafana_cloud_api_key }}" username: "{{ metrics_username }}" url: "{{ prometheus_url }}" ``` -------------------------------- ### Install Specific Version of Grafana Collection Source: https://github.com/grafana/grafana-ansible-collection/blob/main/README.md Install a specific version of the Grafana collection by defining the version in the requirements.yml file. This is useful for ensuring compatibility and reproducibility. ```yaml --- collections: - name: grafana.grafana version: 1.0.0 ``` -------------------------------- ### Configure Promtail Scrape Jobs Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md The `scrape_configs` block defines how Promtail discovers and scrapes logs from various targets. This configuration is mandatory. The example demonstrates scraping system messages and Nginx logs. ```yaml promtail_scrape_configs: - job_name: system static_configs: - targets: - localhost labels: job: messages instance: "{{ ansible_facts['fqdn'] }}" __path__: /var/log/messages - targets: - localhost labels: job: nginx instance: "{{ ansible_facts['fqdn'] }}" __path__: /var/log/nginx/*.log ``` -------------------------------- ### Configure Grafana Alert Notification Channel Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/grafana/README.md Example for configuring an alert notification channel in Grafana. This requires `grafana_use_provisioning` to be true and Grafana version 5.0 or higher. ```yaml grafana_alert_notifications: ``` -------------------------------- ### Specify Grafana Collection in requirements.yml Source: https://github.com/grafana/grafana-ansible-collection/blob/main/README.md Include the Grafana collection in your Ansible project's requirements.yml file for automated installation. This ensures the collection is available when running `ansible-galaxy collection install -r requirements.yml`. ```yaml --- collections: - name: grafana.grafana ``` -------------------------------- ### Ansible Playbook for OpenTelemetry Collector Deployment Source: https://github.com/grafana/grafana-ansible-collection/blob/main/examples/monitor-multiple-instance-otel.md This playbook installs the OpenTelemetry Collector role and configures various components including extensions, receivers, processors, and exporters for Grafana Cloud integration. Ensure you replace placeholder values with your actual Grafana.com API Key and relevant URLs. ```yaml - name: Install OpenTelemetry Collector hosts: all become: true vars: grafana_cloud_api_key: # Example - eyJrIjoiYjI3NjI5MGQxZTcyOTIxYTc0MDgzMGVhNDhlODNhYzA5OTk2Y2U5YiIsIm4iOiJhbnNpYmxldGVzdCIsImlkIjo2NTI5 metrics_username: # Example - 825019 logs_username: # Example - 411478 prometheus_url: # Example - https://prometheus-us-central1.grafana.net/api/prom/push loki_url: # Example - https://logs-prod-017.grafana.net/loki/api/v1/push tempo_url: # Example - tempo-prod-04-prod-us-east-0.grafana.net:443 traces_username: # Example - 411478 tasks: - name: Install OpenTelemetry Collector ansible.builtin.include_role: name: grafana.grafana.opentelemetry_collector vars: otel_collector_extensions: basicauth/grafana_cloud_tempo: # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/basicauthextension client_auth: username: "{{ traces_username }}" password: "{{ grafana_cloud_api_key }}" basicauth/grafana_cloud_prometheus: client_auth: username: "{{ prometheus_url }}" password: "{{ grafana_cloud_api_key }}" basicauth/grafana_cloud_loki: client_auth: username: "{{ logs_username }}" password: "{{ grafana_cloud_api_key }}" otel_collector_receivers: otlp: # https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver protocols: grpc: http: hostmetrics: # Optional. Host Metrics Receiver added as an example of Infra Monitoring capabilities of the OpenTelemetry Collector # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/hostmetricsreceiver scrapers: load: memory: otel_collector_processors: batch: # https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/batchprocessor resourcedetection: # Enriches telemetry data with resource information from the host # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/resourcedetectionprocessor detectors: ["env", "system"] override: false transform/add_resource_attributes_as_metric_attributes: # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/transformprocessor error_mode: ignore metric_statements: - context: datapoint statements: - set(attributes["deployment.environment"], resource.attributes["deployment.environment"]) - set(attributes["service.version"], resource.attributes["service.version"]) otel_collector_exporters: otlp/grafana_cloud_traces: # https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlpexporter endpoint: "{{ tempo_url }}" auth: authenticator: basicauth/grafana_cloud_tempo loki/grafana_cloud_logs: # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/lokiexporter endpoint: "{{ loki_url }}" auth: authenticator: basicauth/grafana_cloud_loki prometheusremotewrite/grafana_cloud_metrics: # https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/prometheusremotewriteexporter endpoint: "{{ prometheus_url }}" add_metric_suffixes: false auth: authenticator: basicauth/grafana_cloud_prometheus otel_collector_service: extensions: [basicauth/grafana_cloud_tempo, basicauth/grafana_cloud_prometheus, basicauth/grafana_cloud_loki] pipelines: traces: receivers: [otlp] processors: [resourcedetection, batch] exporters: [otlp/grafana_cloud_traces] metrics: receivers: [otlp, hostmetrics] processors: [resourcedetection, transform/add_resource_attributes_as_metric_attributes, batch] exporters: [prometheusremotewrite/grafana_cloud_metrics] ``` -------------------------------- ### Create Virtual Environment and Activate Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/mimir/README.md Sets up a Python virtual environment and activates it for managing project dependencies. Use the appropriate activation command for your operating system. ```bash # Create a virtual environment python -m venv .venv # On MacOS, WSL, Linux source .venv/bin/activate # On Windows .\.venv\Scripts\activate ``` -------------------------------- ### Run Minio for Local S3 Backend Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/mimir/README.md Launches a Minio Docker container for local S3 backend testing. It exposes ports 9000 and 9001, connects to the 'molecule' network, and pre-creates a 'mimir' bucket. ```docker docker run -d \ -p 9000:9000 \ -p 9001:9001 \ --name minio-mimir \ --network molecule \ -e "MINIO_ROOT_USER=testtest" \ -e "MINIO_ROOT_PASSWORD=testtest" \ -e "MINIO_DEFAULT_BUCKETS=mimir" \ bitnami/minio:latest ``` -------------------------------- ### Run Ansible Playbook Source: https://github.com/grafana/grafana-ansible-collection/blob/main/examples/monitor-multiple-instances-agent.md This command executes the Ansible playbook defined in `deploy-agent.yml`. Ensure that your `ansible.cfg` and `inventory` files are correctly configured in the same directory or accessible by Ansible. ```bash ansible-playbook deploy-agent.yml ``` -------------------------------- ### Execute Promtail Playbook with Ansible Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Use these commands to deploy or uninstall Promtail. For uninstallation, set the 'promtail_uninstall' variable to true. ```shell # Deploy Promtail ansible-playbook function_promtail_play.yml ``` ```shell # Uninstall Promtail ansible-playbook function_promtail_play.yml -e "promtail_uninstall=true" ``` -------------------------------- ### Set Loki Target Components Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md A comma-separated list of Loki components to run. Defaults to 'all' for single binary mode. ```yaml loki_target: "all" ``` -------------------------------- ### Configure Promtail Server Settings Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md The `server` block configures Promtail's behavior as an HTTP server, including listen port and address. Refer to the Loki documentation for all possible values. ```yaml promtail_server: http_listen_port: "{{ promtail_http_listen_port }}" http_listen_address: "{{ promtail_http_listen_address }}" ``` -------------------------------- ### Run Molecule Verify Test Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/mimir/README.md Executes the 'verify' command in Molecule to run assertions against the provisioned infrastructure. ```bash molecule verify ``` -------------------------------- ### Ansible Configuration File Source: https://github.com/grafana/grafana-ansible-collection/blob/main/examples/monitor-multiple-instances-agent.md Configures Ansible defaults, including the inventory file path, SSH private key, and the remote user for connections. ```ini [defaults] inventory = inventory # Path to the inventory file private_key_file = ~/.ssh/id_rsa # Path to my private SSH Key remote_user=root ``` -------------------------------- ### Run Molecule Converge Test Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/mimir/README.md Executes the 'converge' command in Molecule to apply the Ansible role and set up the infrastructure. ```bash molecule converge ``` -------------------------------- ### Configure Loki Server Settings Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Configures the HTTP listen address, HTTP listen port, and gRPC listen port for the Loki server. Refer to Loki documentation for all possible values. ```yaml loki_server: http_listen_address: "{{ loki_http_listen_address }}" http_listen_port: "{{ loki_http_listen_port }}" grpc_listen_port: 9096 ``` -------------------------------- ### Configure Loki Working Path Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Sets the working directory for Loki. Avoid using '/tmp/loki' as it will be removed and replaced. ```yaml loki_working_path: "/var/lib/loki" ``` -------------------------------- ### Configure Promtail Runtime Mode Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Determines the runtime mode for Promtail. Supports 'acl' (root-less mode using ACL permissions) and 'root' (Promtail runs as root). Defaults to 'acl'. ```yaml promtail_runtime_mode: "acl" ``` -------------------------------- ### Enable Loki Uninstall Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md If set to true, the role will perform an uninstall operation instead of deployment. ```yaml loki_uninstall: "false" ``` -------------------------------- ### Create Molecule Docker Network Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/mimir/README.md Creates a Docker network named 'molecule' to facilitate container communication during Molecule tests. ```bash docker network create molecule ``` -------------------------------- ### Enable Loki Authentication Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Enables authentication via the X-Scope-OrgID header. If false, OrgID defaults to 'fake'. ```yaml loki_auth_enabled: false ``` -------------------------------- ### Configure Loki Ballast Bytes Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Reserves virtual memory in bytes as ballast to optimize garbage collection. Defaults to 0. ```yaml loki_ballast_bytes: 0 ``` -------------------------------- ### Configure Loki Schema Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Sets up the chunk index schema and its storage location. Uses tsdb with filesystem object storage, schema version v13, and a prefix for the index. ```yaml loki_schema_config: configs: - from: 2020-10-24 store: tsdb object_store: filesystem schema: v13 index: prefix: index_ period: 24h ``` -------------------------------- ### Run Ansible Playbook to Deploy OpenTelemetry Collector Source: https://github.com/grafana/grafana-ansible-collection/blob/main/examples/monitor-multiple-instance-otel.md Execute this command to deploy the OpenTelemetry Collector across your hosts using the Ansible playbook. Ensure your Ansible environment is set up correctly. ```sh ansible-playbook deploy-opentelemetry.yml ``` -------------------------------- ### Configure Promtail Port Exposure Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Controls whether a firewalld rule is added to expose the Promtail HTTP listen port. Defaults to `false`. If `true`, a rule is added; if `false`, configuration is skipped. Firewalld tasks are skipped if the `firewalld.service` is not active. ```yaml promtail_expose_port: false ``` -------------------------------- ### Configure Promtail Uninstall Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md If set to `true`, this variable will trigger the uninstallation of Promtail instead of deployment. ```yaml promtail_uninstall: "false" ``` -------------------------------- ### Manage Loki Service Playbook Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md This playbook manages the Loki service using the grafana.grafana.loki role. Ensure 'become: true' is set for privilege escalation. ```yaml - name: Manage loki service hosts: all become: true roles: - role: grafana.grafana.loki ``` -------------------------------- ### Deploy Alloy with Ansible Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/alloy/README.md Execute this command to deploy Grafana Alloy using the defined Ansible playbook. Ensure your playbook file is named 'function_alloy_play.yml'. ```shell ansible-playbook function_alloy_play.yml ``` -------------------------------- ### Default Promtail RPM Download URL Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Specifies the default URL for downloading the Promtail RPM package from GitHub, using templated version and architecture. ```yaml promtail_download_url_rpm: "https://github.com/grafana/loki/releases/download/v{{ promtail_version }}/promtail-{{ promtail_version }}.{{ __promtail_arch }}.rpm" ``` -------------------------------- ### Set Promtail Version Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Specifies the version of Promtail to download and deploy. Supports standard version formats like '3.0.0' or 'latest'. ```yaml promtail_version: "latest" ``` -------------------------------- ### Default Promtail DEB Download URL Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Specifies the default URL for downloading the Promtail DEB package from GitHub, using templated version and architecture. ```yaml promtail_download_url_deb: "https://github.com/grafana/loki/releases/download/v{{ promtail_version }}/promtail_{{ promtail_version }}_{{ __promtail_arch }}.deb" ``` -------------------------------- ### Configure Promtail Positions Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md The `positions` block configures where Promtail saves its position file, which tracks read progress for log files. This enables Promtail to resume processing after restarts. Refer to the Loki documentation for all possible values. ```yaml promtail_positions: filename: "{{ promtail_positions_path }}/positions.yaml" ``` -------------------------------- ### Set Default DEB Download URL Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Specifies the default download URL for the Loki DEB package from GitHub, using templated version and architecture. ```yaml loki_download_url_deb: "https://github.com/grafana/loki/releases/download/v{{ loki_version }}/loki_{{ loki_version }}_{{ __loki_arch }}.deb" ``` -------------------------------- ### Check Metrics Query Source: https://github.com/grafana/grafana-ansible-collection/blob/main/examples/monitor-multiple-instances-agent.md Use this query in your Prometheus data source to check if metrics are being received for a specific instance. Replace 'centos-01' with the actual hostname. ```PromQL {instance="centos-01"} ``` -------------------------------- ### Configure Loki Ruler Alert Path Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Defines the location for storing ruler configuration alerts. Multi-tenancy for alerting is not currently supported. ```yaml loki_ruler_alert_path: "{{ loki_working_path }}/rules/fake" ``` -------------------------------- ### Set Default RPM Download URL Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Specifies the default download URL for the Loki RPM package from GitHub, using templated version and architecture. ```yaml loki_download_url_rpm: "https://github.com/grafana/loki/releases/download/v{{ loki_version }}/loki-{{ loki_version }}.{{ __loki_arch }}.rpm" ``` -------------------------------- ### Configure Loki Ruler Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Configures the Loki ruler, including storage type and directory, rule path, ring configuration, and API/Alertmanager settings. Specifies local storage and enables the ruler API and Alertmanager v2. ```yaml loki_ruler: storage: type: local local: directory: "{{ loki_working_path }}/rules" rule_path: "{{ loki_working_path }}/rules_tmp" ring: kvstore: store: inmemory enable_api: true enable_alertmanager_v2: true alertmanager_url: http://localhost:9093 ``` -------------------------------- ### Set Promtail Positions Path Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Specifies the directory path where Promtail saves its position file. This file tracks read progress for log files, enabling Promtail to resume from where it left off after a restart. ```yaml promtail_positions_path: "/var/lib/promtail" ``` -------------------------------- ### Set Loki Version Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Specifies the version of Loki to download and deploy. Supports standard version formats or 'latest'. ```yaml loki_version: "latest" ``` -------------------------------- ### Set Promtail HTTP Listen Address Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Configures the network address Promtail listens on for HTTP requests. Defaults to '0.0.0.0' to listen on all interfaces. ```yaml promtail_http_listen_address: "0.0.0.0" ``` -------------------------------- ### Configure Loki Common Settings Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Sets common configuration shared across Loki modules, including instance address, path prefix, storage details, replication factor, and ring configuration. More specific configurations override these. ```yaml loki_common: instance_addr: 127.0.0.1 path_prefix: "{{ loki_working_path }}" storage: filesystem: chunks_directory: "{{ loki_working_path }}/chunks" rules_directory: "{{ loki_working_path }}/rules" replication_factor: 1 ring: kvstore: store: inmemory ``` -------------------------------- ### Add Extra Flags to Promtail Systemd Unit Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Allows specifying additional command-line flags to be passed to the Promtail systemd service unit. ```yaml promtail_extra_flags: [] ``` -------------------------------- ### Uninstall Alloy with Ansible Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/alloy/README.md Execute this command to uninstall Grafana Alloy using the defined Ansible playbook. The `alloy_uninstall=true` variable triggers the uninstallation process. ```shell ansible-playbook function_alloy_play.yml -e "alloy_uninstall=true" ``` -------------------------------- ### Configure Loki HTTP Listen Address Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Sets the network address Loki listens on for HTTP requests. Defaults to '0.0.0.0' for all interfaces. ```yaml loki_http_listen_address: "0.0.0.0" ``` -------------------------------- ### Append Promtail User to Groups Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md In root-less mode, this variable appends the Promtail user to specified groups to grant necessary permissions, such as reading system journal logs. ```yaml promtail_user_append_groups: - "systemd-journal" ``` -------------------------------- ### Configure Grafana Security Settings Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/grafana/README.md Set the admin username and password for Grafana. This prevents the password from being changed on the first login. ```yaml - hosts: all roles: - role: grafana.grafana.grafana vars: grafana_ini: security: admin_user: admin admin_password: enter_your_secure_password ``` -------------------------------- ### Configure Loki Query Range Cache Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Configures query splitting and caching for the Loki query-frontend. Enables an embedded cache with a maximum size of 100MB. ```yaml loki_query_range: results_cache: cache: embedded_cache: enabled: true max_size_mb: 100 ``` -------------------------------- ### Set Promtail HTTP Listen Port Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/promtail/README.md Defines the TCP port on which Promtail listens for HTTP requests. Defaults to 9080. ```yaml promtail_http_listen_port: 9080 ``` -------------------------------- ### Control Loki Port Exposure with Firewalld Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Determines whether a firewalld rule is added to expose the Loki HTTP listen port. Defaults to false. Firewalld tasks are skipped if the service is not active. ```yaml loki_expose_port: false ``` -------------------------------- ### Configure Loki HTTP Listen Port Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Defines the TCP port on which Loki listens for HTTP requests. Defaults to 3100. ```yaml loki_http_listen_port: 3100 ``` -------------------------------- ### Configure Loki Analytics Reporting Source: https://github.com/grafana/grafana-ansible-collection/blob/main/roles/loki/README.md Controls anonymous usage reporting for Loki. Disabled by default. ```yaml loki_analytics: reporting_enabled: false ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.