-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(services): sandboxed grafana installation
- Loading branch information
Showing
10 changed files
with
148 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
|
||
- name: Check if folder exist for grafana | ||
ansible.builtin.stat: | ||
path: "{{ grafana_folder }}" | ||
register: grafana_installed | ||
tags: grafana | ||
|
||
- name: Extract the standalone archive | ||
ansible.builtin.unarchive: | ||
src: "grafana-{{ grafana_version }}.linux-amd64.tar.gz" | ||
dest: "{{ local_folder }}" | ||
remote_src: false | ||
when: not grafana_installed.stat.exists | ||
tags: grafana | ||
|
||
- name: Setup grafana | ||
ansible.builtin.template: | ||
src: grafana.ini.j2 | ||
dest: "{{ grafana_folder }}/conf/grafana.ini" | ||
owner: root | ||
group: root | ||
mode: '0644' | ||
notify: | ||
- restart grafana | ||
tags: grafana | ||
|
||
- name: Setup the grafana systemd service | ||
ansible.builtin.template: | ||
src: grafana.service.j2 | ||
dest: "{{ systemd_system }}/grafana.service" | ||
owner: root | ||
group: root | ||
mode: '0644' | ||
notify: | ||
- restart grafana | ||
tags: grafana | ||
|
||
- name: Enable and start grafana | ||
ansible.builtin.systemd: | ||
name: grafana.service | ||
state: started | ||
enabled: true | ||
masked: false | ||
tags: grafana |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[paths] | ||
data = /tmp | ||
temp_data_lifetime = 1h | ||
logs = /var/log | ||
|
||
[server] | ||
protocol = https | ||
min_tls_version = TLS1.3 | ||
http_addr = [{{ wg0_ipv6 }}] | ||
http_port = 3000 | ||
|
||
[database] | ||
type = postgres | ||
host = [::1]:5432 | ||
name = grafana | ||
user = grafana | ||
password = grafana | ||
|
||
[remote_cache] | ||
type = database | ||
|
||
[security] | ||
admin_user = grafana | ||
admin_password = grafana | ||
|
||
[plugins] | ||
plugin_admin_enabled = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[Unit] | ||
Description=Grafana instance | ||
Documentation=http://docs.grafana.org | ||
Wants=network-online.target | ||
After=network-online.target | ||
After=postgresql.service | ||
|
||
[Service] | ||
AmbientCapabilities= | ||
CapabilityBoundingSet= | ||
DevicePolicy=closed | ||
ExecStart={{ grafana_folder }}/bin/grafana server --config={{ grafana_folder }}/conf/grafana.ini | ||
Group=nogroup | ||
LimitNOFILE=32768 | ||
LockPersonality=true | ||
MemoryDenyWriteExecute=false | ||
NoNewPrivileges=true | ||
PrivateDevices=true | ||
PrivateTmp=true | ||
ProcSubset=pid | ||
ProtectClock=true | ||
ProtectControlGroups=true | ||
ProtectHome=true | ||
ProtectHostname=true | ||
ProtectKernelLogs=true | ||
ProtectKernelModules=true | ||
ProtectKernelTunables=true | ||
ProtectProc=invisible | ||
ProtectSystem=strict | ||
RemoveIPC=true | ||
Restart=on-failure | ||
RestrictAddressFamilies=AF_INET AF_INET6 | ||
RestrictNamespaces=true | ||
RestrictRealtime=true | ||
RestrictSUIDSGID=true | ||
SystemCallArchitectures=native | ||
SystemCallFilter=@system-service | ||
SystemCallFilter=~@resources @privileged | ||
TimeoutStopSec=20 | ||
Type=simple | ||
UMask=0027 | ||
User=nobody | ||
WorkingDirectory={{ grafana_folder }} | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters