From 95b73daa36b23565a8566f71f9b202d3459b685f Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sun, 25 Jun 2023 09:52:36 -0400 Subject: Initial Commit --- roles/services/monitoring/loki/tasks/main.yml | 80 +++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 roles/services/monitoring/loki/tasks/main.yml (limited to 'roles/services/monitoring/loki/tasks') 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 @@ +- name: install extrepo + package: + name: extrepo + state: latest + +- name: add Grafana repo + register: result + changed_when: result.stdout | regex_search("skipped") | bool + notify: update repos + command: + cmd: extrepo enable grafana + creates: /etc/apt/sources.list.d/extrepo_grafana.sources + +- meta: flush_handlers + +- name: add Grafana repo + changed_when: false + command: + cmd: extrepo update grafana + +- name: install loki + package: + name: loki + state: latest + +- name: deploy loki configuration + copy: + src: "{{ loki_config }}" + dest: /etc/loki/config.yml + owner: root + group: root + mode: '0644' + +- name: deploy nginx configuration + copy: + src: "{{ loki_nginx_config }}" + dest: /etc/nginx/sites-available/loki.conf + owner: root + group: root + mode: '0644' + register: nginxconfig + notify: restart nginx + +- name: symlink site + file: + src: /etc/nginx/sites-available/loki.conf + dest: /etc/nginx/sites-enabled/loki.conf + owner: root + group: root + state: link + +- name: allow http (80/tcp) traffic + ufw: + rule: allow + port: '80' + proto: tcp + +- name: allow https (443/tcp) traffic + ufw: + rule: allow + port: '443' + proto: tcp + +- name: allow loki log (3100/tcp) traffic + ufw: + rule: allow + port: '3100' + proto: tcp + +- name: enable loki + systemd: + daemon_reload: yes + enabled: yes + masked: no + name: loki + +- name: restart loki + systemd: + name: loki + state: restarted -- cgit v1.2.3