Add grafana role
This commit is contained in:
parent
d0f3d828df
commit
b818249d82
11
roles/grafana/handlers/main.yml
Normal file
11
roles/grafana/handlers/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
- name: restart grafana
|
||||
service:
|
||||
name: grafana
|
||||
state: restarted
|
||||
when: "'handler' not in ansible_skip_tags"
|
||||
|
||||
- name: reload nginx
|
||||
service:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
when: "'handler' not in ansible_skip_tags"
|
28
roles/grafana/tasks/main.yml
Normal file
28
roles/grafana/tasks/main.yml
Normal file
|
@ -0,0 +1,28 @@
|
|||
- name: Install packages
|
||||
package:
|
||||
name: grafana
|
||||
|
||||
- name: Configure grafana
|
||||
ini_file:
|
||||
path: /etc/grafana.ini
|
||||
section: '{{ item.section | default("") }}'
|
||||
option: '{{ item.option }}'
|
||||
value: '{{ item.value }}'
|
||||
loop:
|
||||
- { section: analytics, option: reporting_enabled, value: false }
|
||||
- { section: analytics, option: check_for_updates, value: false }
|
||||
- { section: analytics, option: check_for_plugin_updates, value: false }
|
||||
- { section: news, option: news_feed_enabled, value: false }
|
||||
- { section: public_dashboards, option: enabled, value: false }
|
||||
|
||||
- name: Set up nginx site
|
||||
template:
|
||||
dest: '/etc/nginx/http.d/grafana.conf'
|
||||
src: 'nginx.conf.j2'
|
||||
notify: reload nginx
|
||||
|
||||
- name: Enable grafana
|
||||
service:
|
||||
name: grafana
|
||||
enabled: yes
|
||||
state: started
|
13
roles/grafana/templates/nginx.conf.j2
Normal file
13
roles/grafana/templates/nginx.conf.j2
Normal file
|
@ -0,0 +1,13 @@
|
|||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
server_name {{ dns_name }};
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/{{ dns_name }}/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/{{ dns_name }}/privkey.pem;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:3000;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue