From 84db437ca59c4696b8af704f27382543d97fa29a Mon Sep 17 00:00:00 2001
From: Rutger <3618255-rutger9321@users.noreply.gitlab.com>
Date: Mon, 9 Aug 2021 12:24:36 +0200
Subject: [PATCH 1/3] Add Loki ruler config to loki.yml and defaults

---
 defaults/main.yml     | 3 ++-
 templates/loki.yml.j2 | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/defaults/main.yml b/defaults/main.yml
index f74460d..7e677a8 100644
--- a/defaults/main.yml
+++ b/defaults/main.yml
@@ -76,6 +76,7 @@ loki_table_manager_config:
   retention_deletes_enabled: false
   retention_period: 0s
 
+loki_ruler_config: []
 
 promtail_client_config:
   - url: "http://{{ loki_listen_address }}:{{ loki_listen_port }}/loki/api/v1/push"
@@ -100,4 +101,4 @@ promtail_scrape_config:
 
 promtail_target_config: []
 promtail_positions_config:
-  filename: /tmp/positions.yaml
\ No newline at end of file
+  filename: /tmp/positions.yaml
diff --git a/templates/loki.yml.j2 b/templates/loki.yml.j2
index 5438373..c627621 100644
--- a/templates/loki.yml.j2
+++ b/templates/loki.yml.j2
@@ -57,3 +57,7 @@ table_manager:
 runtime_config:
   {{ loki_runtime_config | to_nice_yaml(indent=2) | indent(2, False) }}
 {% endif %}
+{% if loki_ruler_config != [] %}
+ruler:
+  {{ loki_ruler_config | to_nice_yaml(indent=2) | indent(2, False) }}
+{% endif %}

From cffd32e8a4c17aa5fe6bfe9c8bb42f2b10a0b798 Mon Sep 17 00:00:00 2001
From: Rutger <357924+rutger1140@users.noreply.github.com>
Date: Fri, 27 Aug 2021 11:28:40 +0200
Subject: [PATCH 2/3] Enable systemd services on boot

---
 handlers/main.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/handlers/main.yml b/handlers/main.yml
index a3c4fcf..0d2e77c 100644
--- a/handlers/main.yml
+++ b/handlers/main.yml
@@ -5,6 +5,7 @@
     daemon_reload: true
     name: loki
     state: restarted
+    enabled: true
   when: ('loki' in loki_bins)
 
 - name: reload loki
@@ -20,6 +21,7 @@
     daemon_reload: true
     name: promtail
     state: restarted
+    enabled: true
   when: ('promtail' in loki_bins)
 
 - name: reload promtail
@@ -27,4 +29,4 @@
   systemd:
     name: promtail
     state: reloaded
-  when: ('promtail' in loki_bins)
\ No newline at end of file
+  when: ('promtail' in loki_bins)

From 1e0499db465eef840329ff8e95620eca44554961 Mon Sep 17 00:00:00 2001
From: Rutger <357924+rutger1140@users.noreply.github.com>
Date: Fri, 27 Aug 2021 11:30:31 +0200
Subject: [PATCH 3/3] Update README.md

---
 README.md | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index f32b2a0..30b0129 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,12 @@
-Role Name
-=========
+# Fork of [diogenxs/ansible-role-loki](https://github.com/diogenxs/ansible-role-loki)
+
+- Added enabling systemd service 
+- Added loki_ruler config
+
+---
+
+Ansible Role Loki
+=================
 
 Deploy and configure [Loki/Promtail](https://github.com/grafana/loki) using Ansible.
 
@@ -27,4 +34,4 @@ WTFPL see [LICENSE](license)
 Author Information
 ------------------
 
-https://diogenxs.dev
\ No newline at end of file
+https://diogenxs.dev