Compare commits
2 commits
1f5d2f6238
...
b818249d82
Author | SHA1 | Date | |
---|---|---|---|
Timotej Lazar | b818249d82 | ||
Timotej Lazar | d0f3d828df |
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;
|
||||
}
|
||||
}
|
2
roles/influxdb/files/config.toml
Normal file
2
roles/influxdb/files/config.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
reporting-disabled = true
|
||||
http-bind-address = "localhost:8087"
|
16
roles/influxdb/files/influxdb.initd
Normal file
16
roles/influxdb/files/influxdb.initd
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
command="influxd"
|
||||
command_background="yes"
|
||||
command_user="${command_user:-influxdb:influxdb}"
|
||||
directory="${data_path:-/var/lib/influxdb}"
|
||||
pidfile="/run/$RC_SVCNAME.pid"
|
||||
start_stop_daemon_args="--stdout-logger /usr/bin/logger"
|
||||
|
||||
depend() {
|
||||
use logger
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -d -o "$command_user" -m755 "${data_path:-/var/lib/influxdb}"
|
||||
}
|
11
roles/influxdb/handlers/main.yml
Normal file
11
roles/influxdb/handlers/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
- name: restart influxdb
|
||||
service:
|
||||
name: influxdb
|
||||
state: restarted
|
||||
when: "'handler' not in ansible_skip_tags"
|
||||
|
||||
- name: reload nginx
|
||||
service:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
when: "'handler' not in ansible_skip_tags"
|
48
roles/influxdb/tasks/main.yml
Normal file
48
roles/influxdb/tasks/main.yml
Normal file
|
@ -0,0 +1,48 @@
|
|||
- name: Create influxdb group
|
||||
group:
|
||||
name: influxdb
|
||||
system: yes
|
||||
|
||||
- name: Create influxdb user
|
||||
user:
|
||||
name: influxdb
|
||||
system: yes
|
||||
home: /var/lib/influxdb
|
||||
shell: /sbin/nologin
|
||||
|
||||
- name: Install tar
|
||||
package:
|
||||
name: tar
|
||||
|
||||
- name: Install influxdb
|
||||
unarchive:
|
||||
src: https://download.influxdata.com/influxdb/releases/influxdb2-{{ influxdb_version }}_linux_amd64.tar.gz
|
||||
dest: /
|
||||
remote_src: yes
|
||||
extra_opts:
|
||||
- '--strip-components=1'
|
||||
notify: restart influxdb
|
||||
|
||||
- name: Install influxdb initscript
|
||||
copy:
|
||||
dest: /etc/init.d/influxdb
|
||||
src: influxdb.initd
|
||||
mode: 0755
|
||||
notify: restart influxdb
|
||||
|
||||
- name: Configure influxdb
|
||||
copy:
|
||||
dest: /var/lib/influxdb/
|
||||
src: config.toml
|
||||
|
||||
- name: Set up nginx site
|
||||
template:
|
||||
dest: '/etc/nginx/http.d/influxdb.conf'
|
||||
src: 'nginx.conf.j2'
|
||||
notify: reload nginx
|
||||
|
||||
- name: Enable influxdb
|
||||
service:
|
||||
name: influxdb
|
||||
enabled: yes
|
||||
state: started
|
12
roles/influxdb/templates/nginx.conf.j2
Normal file
12
roles/influxdb/templates/nginx.conf.j2
Normal file
|
@ -0,0 +1,12 @@
|
|||
server {
|
||||
listen 8086 ssl;
|
||||
listen [::]:8086 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:8087;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue