[syncthing] generalize it
change wvzmyxqyqpwuykkuxskukuwmkrywymnv
commit caa4ae8fa2e1a87f90723a632686903207220e13
author Alpha Chen <alpha@kejadlen.dev>
date
parent uyswknty
diff --git a/hosts.yml b/hosts.yml
index 1d4ba33..fe47274 100644
--- a/hosts.yml
+++ b/hosts.yml
@@ -11,6 +11,7 @@ all:
     legacy-of-lunatic-kingdom:
     lotus-land-story:
     mountain-of-faith:
+      data_dir: /mnt/mountain-of-faith
 local:
   hosts:
     localhost:
diff --git a/lotus-land-story/templates/scrape.yml b/lotus-land-story/templates/scrape.yml
index 18d649f..8e72ca5 100644
--- a/lotus-land-story/templates/scrape.yml
+++ b/lotus-land-story/templates/scrape.yml
@@ -158,11 +158,11 @@ scrape_configs:
         target_label: instance
         replacement: 'lotus-land-story:9187'
 
-  - job_name: victoria-logs
-    static_configs:
-      - targets: ['victoria-logs:9428']
-
   - job_name: syncthing
     bearer_token: {{ syncthing.api_key }}
     static_configs:
       - targets: ['mountain-of-faith:8384']
+
+  - job_name: victoria-logs
+    static_configs:
+      - targets: ['victoria-logs:9428']
diff --git a/mountain-of-faith/main.yml b/mountain-of-faith/main.yml
index c5760f7..5a83095 100644
--- a/mountain-of-faith/main.yml
+++ b/mountain-of-faith/main.yml
@@ -123,7 +123,7 @@
         state: started
 
 - import_playbook: minio.yml
-- import_playbook: syncthing.yml
+- import_playbook: ../playbooks/syncthing.yml
 
 - name: Set up metrics
   tags: metrics
diff --git a/mountain-of-faith/syncthing.yml b/playbooks/syncthing.yml
similarity index 96%
rename from mountain-of-faith/syncthing.yml
rename to playbooks/syncthing.yml
index 1cf68a2..d8e11c8 100644
--- a/mountain-of-faith/syncthing.yml
+++ b/playbooks/syncthing.yml
@@ -2,7 +2,7 @@
 
 - name: Install Syncthing
   tags: syncthing
-  hosts: mountain-of-faith
+  hosts: all
   become: true
   tasks:
 
@@ -47,7 +47,7 @@
 
     - name: Create Syncthing data directory
       ansible.builtin.file:
-        path: /mnt/mountain-of-faith/syncthing
+        path: "{{ (data_dir, 'syncthing') | path_join }}"
         state: directory
         owner: syncthing
         group: syncthing