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 overrides.conf with CAP_NET_BIND_SERVICE for grafana-server unit… #88

Merged
merged 2 commits into from
Aug 28, 2023
Merged
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
21 changes: 21 additions & 0 deletions roles/grafana/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,27 @@
- "grafana_port | int <= 1024"
- "grafana_cap_net_bind_service"

- name: Create a directory for overrides.conf unit file if it does not exist
ansible.builtin.file:
path: /etc/systemd/system/grafana-server.service.d
state: directory
mode: '0755'
when:
- "grafana_port | int <= 1024"
- "grafana_cap_net_bind_service"

- name: "Enable grafana to ports lower than port 1024 in systemd unitfile"

Check failure on line 88 in roles/grafana/tasks/configure.yml

View workflow job for this annotation

GitHub Actions / Perform Linting

risky-file-permissions

File permissions unset or incorrect.
ansible.builtin.blockinfile:
path: /etc/systemd/system/grafana-server.service.d/overrides.conf
create: true
block: |
[Service]
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
when:
- "grafana_port | int <= 1024"
- "grafana_cap_net_bind_service"

- name: "Enable and start Grafana systemd unit"
ansible.builtin.systemd:
name: "grafana-server"
Expand Down
8 changes: 8 additions & 0 deletions roles/grafana/templates/grafana.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ root_url = {{ grafana_url }}
{% endif %}
{% endfor %}

# Plugins
{% if grafana_plugins_ops is defined %}
[plugins]
{% for k,v in grafana_plugins_ops.items() %}
{{ k }} = {{ v }}
{% endfor %}
{% endif %}

# Remote cache
[remote_cache]
{% for k,v in grafana_remote_cache.items() %}
Expand Down
Loading