diff --git a/lotus-land-story/gotosocial.yml b/lotus-land-story/gotosocial.yml
index 0af50d7..645764f 100644
--- a/lotus-land-story/gotosocial.yml
+++ b/lotus-land-story/gotosocial.yml
@@ -5,7 +5,7 @@
vars_files:
- vars.yml
vars:
- version: 0.17.2
+ version: 0.17.4
tasks:
- name: Create working directory
@@ -22,6 +22,31 @@
group: 1000
mode: "0755"
+ - name: Back up before upgrades
+ block:
+
+ - name: Get current version
+ ansible.builtin.command: >
+ docker inspect
+ --format '{{ '{{' }} index .Config.Labels "org.opencontainers.image.version"}}'
+ gotosocial
+ register: gotosocial_version
+ changed_when: false
+
+ - name: Stop and backup gotosocial
+ when: gotosocial_version.stdout | trim != version
+ block:
+ - name: Stop gotosocial
+ community.docker.docker_container:
+ name: gotosocial
+ state: stopped
+ - name: Backup db
+ ansible.builtin.copy:
+ src: /mnt/lotus-land-story/gotosocial/data/sqlite.db
+ dest: /mnt/lotus-land-story/gotosocial/sqlite.db.bak
+ mode: "0400"
+ remote_src: true
+
# https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/example/docker-compose/docker-compose.yaml
- name: Run GoToSocial
community.docker.docker_container: