[syncthing] legacy-of-lunatic-kingdom
diff --git a/hosts.yml b/hosts.yml
index fe47274..831eaad 100644
--- a/hosts.yml
+++ b/hosts.yml
@@ -9,6 +9,7 @@ all:
ansible_python_interpreter: /usr/bin/python3
hopeless-masquerade:
legacy-of-lunatic-kingdom:
+ data_dir: /mnt/legacy-of-lunatic-kingdom
lotus-land-story:
mountain-of-faith:
data_dir: /mnt/mountain-of-faith
diff --git a/legacy-of-lunatic-kingdom/main.yml b/legacy-of-lunatic-kingdom/main.yml
index 8db7b6d..820708e 100644
--- a/legacy-of-lunatic-kingdom/main.yml
+++ b/legacy-of-lunatic-kingdom/main.yml
@@ -10,6 +10,7 @@
- net-tools # ifconfig
- neovim
- prometheus-node-exporter
+ - python3-lxml # ansible bcrypt
state: present
update_cache: true
@@ -46,5 +47,6 @@
# TODO disallow network access from non-tailscale interfaces
- import_playbook: ../playbooks/tailscale.yml # noqa: name[play]
- import_playbook: ../playbooks/docker.yml # noqa: name[play]
+- import_playbook: ../playbooks/syncthing.yml # noqa: name[play]
# vim: ft=yaml.ansible
diff --git a/lotus-land-story/templates/scrape.yml b/lotus-land-story/templates/scrape.yml
index 8e72ca5..7701d53 100644
--- a/lotus-land-story/templates/scrape.yml
+++ b/lotus-land-story/templates/scrape.yml
@@ -161,7 +161,9 @@ scrape_configs:
- job_name: syncthing
bearer_token: {{ syncthing.api_key }}
static_configs:
- - targets: ['mountain-of-faith:8384']
+ - targets:
+ - legacy-of-lunatic-kingdom:8384
+ - mountain-of-faith:8384
- job_name: victoria-logs
static_configs:
diff --git a/playbooks/syncthing.yml b/playbooks/syncthing.yml
index d8e11c8..9972884 100644
--- a/playbooks/syncthing.yml
+++ b/playbooks/syncthing.yml
@@ -13,16 +13,23 @@
fail_msg: "This playbook only supports Debian distributions"
# sudo mkdir -p /etc/apt/keyrings
+ - name: Create APT keyrings directory
+ ansible.builtin.file:
+ path: /etc/apt/keyrings
+ state: directory
+ mode: '0755'
+
# sudo curl -L -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
- - name: Add Syncthing GPG key
- ansible.builtin.apt_key:
+ - name: Download Syncthing GPG key
+ ansible.builtin.get_url:
url: https://syncthing.net/release-key.gpg
- state: present
+ dest: /etc/apt/keyrings/syncthing-archive-keyring.gpg
+ mode: '0644'
- # echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
+ # echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable-v2" | sudo tee /etc/apt/sources.list.d/syncthing.list
- name: Add Syncthing repository
ansible.builtin.apt_repository:
- repo: deb https://apt.syncthing.net/ syncthing stable
+ repo: deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable-v2
state: present
# sudo apt-get update
@@ -60,13 +67,21 @@
state: started
daemon_reload: true
- - name: Update GUI listen address in config.xml
- ansible.builtin.lineinfile:
+ - name: Update configuration in config.xml
+ community.general.xml:
path: /home/syncthing/.local/state/syncthing/config.xml
- regexp: '^\s*<address>.*:8384</address>'
- line: ' <address>0.0.0.0:8384</address>'
+ xpath: "/configuration/{{ item.key }}"
+ value: "{{ item.value }}"
+ attribute: "{{ item.attribute | default(omit) }}"
backup: true
notify: restart syncthing
+ loop:
+ - { key: "gui/address", value: "0.0.0.0:8384" }
+ - { key: "gui/user", value: "{{ syncthing.user }}" }
+ - { key: "gui/password", value: '{{ syncthing.password | password_hash("bcrypt") }}' }
+ - { key: "options/minHomeDiskFree", value: "0" }
+ - { key: "defaults/folder/minDiskFree", value: "75" }
+ - { key: "defaults/folder/minDiskFree", attribute: "unit", value: "%" }
handlers:
- name: restart syncthing