This repository was archived by the owner on May 31, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +45
-1
lines changed Expand file tree Collapse file tree 5 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 47
47
- " {{ grafana_data_dir }}/dashboards"
48
48
- " {{ grafana_data_dir }}/plugins"
49
49
50
+ - block :
51
+ - name : Create grafana socket directory
52
+ file :
53
+ path : " {{ grafana_server.socket | dirname }}"
54
+ state : directory
55
+ mode : 0775
56
+ owner : " grafana"
57
+ group : " grafana"
58
+
59
+ - name : Ensure grafana socket directory created on startup
60
+ template :
61
+ src : tmpfiles.j2
62
+ dest : /etc/tmpfiles.d/grafana.conf
63
+ owner : root
64
+ group : root
65
+ mode : 0644
66
+ when :
67
+ - grafana_server.protocol is defined and grafana_server.protocol == 'socket'
68
+ - grafana_server.socket | dirname != '/var/run'
69
+
50
70
- name : Enable grafana to ports lower than port 1024
51
71
capabilities :
52
72
path : /usr/sbin/grafana-server
Original file line number Diff line number Diff line change 47
47
- grafana_dashboards
48
48
- grafana_run
49
49
50
- - name : Wait for grafana to start
50
+ - name : Wait for grafana to start (http/s)
51
51
wait_for :
52
52
host : " {{ grafana_address }}"
53
53
port : " {{ grafana_port }}"
54
+ when : grafana_server.protocol is undefined or grafana_server.protocol in ['http', 'https']
55
+ tags :
56
+ - grafana_install
57
+ - grafana_configure
58
+ - grafana_datasources
59
+ - grafana_notifications
60
+ - grafana_dashboards
61
+ - grafana_run
62
+
63
+ - name : Wait for grafana to start (socket)
64
+ wait_for :
65
+ path : " {{ grafana_server.socket }}"
66
+ when : grafana_server.protocol is defined and grafana_server.protocol == 'socket'
54
67
tags :
55
68
- grafana_install
56
69
- grafana_configure
Original file line number Diff line number Diff line change 83
83
when :
84
84
- grafana_port <= 1024
85
85
- not grafana_cap_net_bind_service
86
+
87
+ - name : Fail if grafana_server.socket not defined when in socket mode
88
+ fail :
89
+ msg : " You need to configure grafana_server.socket when grafana_server.protocol is set to 'socket'"
90
+ when :
91
+ - grafana_server.protocol is defined and grafana_server.protocol == 'socket'
92
+ - grafana_server.socket is undefined or grafana_server.socket == ''
Original file line number Diff line number Diff line change @@ -15,8 +15,10 @@ plugins = {{ grafana_data_dir }}/plugins
15
15
16
16
# HTTP options
17
17
[server]
18
+ {% if grafana_server .protocol is undefined or grafana_server .protocol in ['http' , 'https' ] %}
18
19
http_addr = {{ grafana_address }}
19
20
http_port = {{ grafana_port }}
21
+ {% endif %}
20
22
domain = {{ grafana_domain }}
21
23
root_url = {{ grafana_url }}
22
24
{% for k ,v in grafana_server .items () %}
Original file line number Diff line number Diff line change
1
+ {{ ansible_managed | comment }}
2
+ d {{ grafana_server.socket | dirname }} 0775 grafana grafana
You can’t perform that action at this time.
0 commit comments