Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to grant read access to paths using ACL #223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
| `promtail_log_level` | "info" | Loglevel of promtail (one of: `debug`,`info`,`warn`,`error` ) |
| `promtail_config_include_default_file_sd_config` | "True" | When set to false, the default `file_sd` will not be provisioned |
| `promtail_apt_update_cache` | "True" | When set to false the role will not update the APT cache on its own |
| `promtail_acl_read_paths` | [] | Paths (folders or files) to which promtail should receive read access through acl, regardless of owner/group |

For each section (`promtail_config_clients`, `promtail_config_server`,`promtail_config_positions`,`promtail_config_scrape_configs`,`promtail_target_config`) the configuration can be passed accrodingly to the [official promtail configuration](https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md).
For each section (`promtail_config_clients`, `promtail_config_server`,`promtail_config_positions`,`promtail_config_scrape_configs`,`promtail_target_config`) the configuration can be passed accordingly to the [official promtail configuration](https://github.com/grafana/loki/blob/master/docs/clients/promtail/configuration.md).
The role will converte the ansible vars into the respective yaml configuration for loki.

## Example Playbook
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ promtail_config_default_file_sd_config:
- "{{ promtail_config_file_sd_dir }}/*.yaml"
- "{{ promtail_config_file_sd_dir }}/*.json"

promtail_acl_read_paths: []

promtail_target_config: {}
# promtail_target_config:
# sync_period: "10s"
10 changes: 10 additions & 0 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,13 @@
src: "{{ promtail_systemd_service_template_file }}"
dest: "/etc/systemd/system/{{ promtail_systemd_service }}.service"
mode: 0644

- name: Grant promtail read access to configured paths
acl:
path: "{{ item }}"
entity: "{{ promtail_system_user }}"
etype: user
permissions: rX
recursive: yes
state: present
with_items: "{{ promtail_acl_read_paths }}"