Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
authorLuke Hoersten <luke@hoersten.org>
Mon, 05 Sep 2022 16:02:56 -0500
changeset 187 0f3a64c60ec5
parent 186 c48761176ede
child 188 4f2ad619134b
Added lnd REST api to nginx. Moved prometheus and apt-cacher data to external hdd.
apt-cacher/server/tasks/main.yaml
prometheus/server/defaults/main.yaml
prometheus/server/tasks/main.yaml
--- a/apt-cacher/server/tasks/main.yaml	Mon Sep 05 11:14:48 2022 -0500
+++ b/apt-cacher/server/tasks/main.yaml	Mon Sep 05 16:02:56 2022 -0500
@@ -3,6 +3,7 @@
 - name: install apt packages
   become: yes
   apt: name="apt-cacher-ng"
+  notify: restart apt-cacher-ng
 
 - name: configure apt-cacher dirs
   become: yes
@@ -15,3 +16,16 @@
     - { key: "CacheDir", val: "{{apt_cacher_cache_dir}}" }
     - { key: "LogDir", val: "{{apt_cacher_log_dir}}" }
     - { key: "Port", val: "{{apt_cacher_port}}" }
+  notify: restart apt-cacher-ng
+
+- name: make cache and log dirs
+  become: yes
+  file:
+    path: "{{item}}"
+    state: "directory"
+    owner: "apt-cacher-ng"
+    group: "apt-cacher-ng"
+  loop:
+    - "{{apt_cacher_cache_dir}}"
+    - "{{apt_cacher_log_dir}}"
+  notify: restart apt-cacher-ng
--- a/prometheus/server/defaults/main.yaml	Mon Sep 05 11:14:48 2022 -0500
+++ b/prometheus/server/defaults/main.yaml	Mon Sep 05 16:02:56 2022 -0500
@@ -5,5 +5,4 @@
   - "prometheus"
   - "grafana"
 
-prometheus_server_grafana_plugins:
-  - "flant-statusmap-panel"
+prometheus_server_data_dir: "/var/lib/prometheus/metrics2"
--- a/prometheus/server/tasks/main.yaml	Mon Sep 05 11:14:48 2022 -0500
+++ b/prometheus/server/tasks/main.yaml	Mon Sep 05 16:02:56 2022 -0500
@@ -12,6 +12,24 @@
   become: yes
   apt: name="{{prometheus_server_apt_packages}}" state="latest"
 
+- name: make prometheus data dir
+  become: yes
+  file:
+    path: "{{prometheus_server_data_dir}}"
+    state: "directory"
+    owner: "prometheus"
+    group: "prometheus"
+    recurse: yes
+  notify: restart prometheus service
+
+- name: configure prometheus data dir
+  become: yes
+  lineinfile:
+    path: "/etc/default/prometheus"
+    regexp: '^ARGS="'
+    line: 'ARGS="--storage.tsdb.path={{prometheus_server_data_dir}}"'
+  notify: restart prometheus service
+
 - name: configure prometheus
   become: yes
   template:
@@ -37,10 +55,10 @@
 #     is_default: yes
 #   changed_when: false
 
-- name: install grafana plugins
-  become: yes
-  grafana_plugin: name="{{item}}"
-  loop: "{{prometheus_server_grafana_plugins}}"
+# - name: install grafana plugins
+#   become: yes
+#   grafana_plugin: name="{{item}}"
+#   loop: "{{prometheus_server_grafana_plugins}}"
 
 - name: copy dashboards to target
   become: yes
@@ -50,9 +68,10 @@
     mode: "0640"
   loop: "{{prometheus_server_grafana_dashboards}}"
 
-# - name: install grafana dashboards
-#   become: yes
-#   grafana_dashboard:
-#     grafana_url: "http://localhost:3000"
-#     path: "/tmp/{{item}}"
-#   loop: "{{prometheus_server_grafana_dashboards}}"
+- name: install grafana dashboards
+  become: yes
+  grafana_dashboard:
+    grafana_url: "http://localhost:3000"
+    path: "/tmp/{{item}}"
+    overwrite: yes
+  loop: "{{prometheus_server_grafana_dashboards}}"