aboutsummaryrefslogtreecommitdiff
path: root/roles/services/monitoring/loki
diff options
context:
space:
mode:
Diffstat (limited to 'roles/services/monitoring/loki')
-rw-r--r--roles/services/monitoring/loki/handlers/main.yml8
-rw-r--r--roles/services/monitoring/loki/tasks/main.yml80
2 files changed, 88 insertions, 0 deletions
diff --git a/roles/services/monitoring/loki/handlers/main.yml b/roles/services/monitoring/loki/handlers/main.yml
new file mode 100644
index 0000000..e70412f
--- /dev/null
+++ b/roles/services/monitoring/loki/handlers/main.yml
@@ -0,0 +1,8 @@
1- name: update repos
2 apt:
3 update_cache: yes
4
5- name: restart nginx
6 service:
7 name: nginx
8 state: restarted
diff --git a/roles/services/monitoring/loki/tasks/main.yml b/roles/services/monitoring/loki/tasks/main.yml
new file mode 100644
index 0000000..31a7375
--- /dev/null
+++ b/roles/services/monitoring/loki/tasks/main.yml
@@ -0,0 +1,80 @@
1- name: install extrepo
2 package:
3 name: extrepo
4 state: latest
5
6- name: add Grafana repo
7 register: result
8 changed_when: result.stdout | regex_search("skipped") | bool
9 notify: update repos
10 command:
11 cmd: extrepo enable grafana
12 creates: /etc/apt/sources.list.d/extrepo_grafana.sources
13
14- meta: flush_handlers
15
16- name: add Grafana repo
17 changed_when: false
18 command:
19 cmd: extrepo update grafana
20
21- name: install loki
22 package:
23 name: loki
24 state: latest
25
26- name: deploy loki configuration
27 copy:
28 src: "{{ loki_config }}"
29 dest: /etc/loki/config.yml
30 owner: root
31 group: root
32 mode: '0644'
33
34- name: deploy nginx configuration
35 copy:
36 src: "{{ loki_nginx_config }}"
37 dest: /etc/nginx/sites-available/loki.conf
38 owner: root
39 group: root
40 mode: '0644'
41 register: nginxconfig
42 notify: restart nginx
43
44- name: symlink site
45 file:
46 src: /etc/nginx/sites-available/loki.conf
47 dest: /etc/nginx/sites-enabled/loki.conf
48 owner: root
49 group: root
50 state: link
51
52- name: allow http (80/tcp) traffic
53 ufw:
54 rule: allow
55 port: '80'
56 proto: tcp
57
58- name: allow https (443/tcp) traffic
59 ufw:
60 rule: allow
61 port: '443'
62 proto: tcp
63
64- name: allow loki log (3100/tcp) traffic
65 ufw:
66 rule: allow
67 port: '3100'
68 proto: tcp
69
70- name: enable loki
71 systemd:
72 daemon_reload: yes
73 enabled: yes
74 masked: no
75 name: loki
76
77- name: restart loki
78 systemd:
79 name: loki
80 state: restarted