Skip to content

Commit

Permalink
Support adding alloy user to extra groups (#212)
Browse files Browse the repository at this point in the history
Co-authored-by: Ishan Jain <[email protected]>
  • Loading branch information
v-zhuravlev and ishanjainn authored Jun 3, 2024
1 parent 1e161d7 commit 8dbd124
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions roles/alloy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions roles/alloy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
2 changes: 1 addition & 1 deletion roles/alloy/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- name: Create alloy user
ansible.builtin.user:
name: "{{ service_user }}"

Check warning on line 15 in roles/alloy/tasks/install.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

jinja[spacing]

Jinja2 spacing could be improved: {{ [ service_group ] + alloy_user_groups }} -> {{ \[service_group] + alloy_user_groups }}
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
Expand Down

0 comments on commit 8dbd124

Please sign in to comment.