diff --git a/roles/alloy/README.md b/roles/alloy/README.md index 2ec0e4d4..39646ebf 100644 --- a/roles/alloy/README.md +++ b/roles/alloy/README.md @@ -30,6 +30,8 @@ Available variables with their default values are listed below (`defaults/main.y | `alloy_flags_extra` | Extra flags to pass to the Alloy service. | {} (Empty dictionary) | | `start_after_service` | Specify an optional dependency service Alloy should start after. | '' (Empty string) | | `config` | Configuration template for Grafana Alloy. | Configuration script with Prometheus scrape and remote_write setup | +| `alloy_user_groups`. | Configurable user groups that the Grafana Alloy can be put in so that it can access logs. | `[]` | + ## Example Playbook diff --git a/roles/alloy/defaults/main.yml b/roles/alloy/defaults/main.yml index 3f00bd9d..fefc2555 100644 --- a/roles/alloy/defaults/main.yml +++ b/roles/alloy/defaults/main.yml @@ -43,3 +43,6 @@ config: | url = "http://mimir:9009/api/v1/push" } } + +# Configurable user groups that the Grafana Alloy can be put in so that it can access logs. +alloy_user_groups: [] diff --git a/roles/alloy/tasks/install.yml b/roles/alloy/tasks/install.yml index 2ee35999..b78a9532 100644 --- a/roles/alloy/tasks/install.yml +++ b/roles/alloy/tasks/install.yml @@ -13,7 +13,7 @@ - name: Create alloy user ansible.builtin.user: name: "{{ service_user }}" - group: "{{ service_group }}" + groups: "{{ [ service_group ] + alloy_user_groups }}" system: true create_home: false # Appropriate for a system user, usually doesn't need a home directory become: true