diff --git a/files/docker_persistent_data/.gitkeep b/files/docker_persistent_data/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index c4c463b9..16355256 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -89,12 +89,8 @@ security_autoupdate_mail_to: "{{ email }}" security_autoupdate_mail_on_error: true # -# Docker +# Enable/disable individual Docker containers # -copy_persistent_data: false - -force_copy_persistent_data: false - enable_deconz: true enable_homeassistant: true @@ -145,7 +141,6 @@ enable_timemachine: true # # IKEv2 # - ikev2_ondemand: true # @@ -248,10 +243,12 @@ snapraid_runner_smtp_port: "{{ email_smtp_port }}" snapraid_runner_command: "python3 {{ snapraid_runner_bin }} -c {{ snapraid_runner_conf }}" +# Stop all the docker containers, backup the {{ docker_dir }} to the MergerFS pool, execute the snapraid runner and start the containers back up +# Stopping the containers is necessary – backing up the data folder with the containers running will result in corrputed database files and no files can be changed during the Snapraid sync snapraid_runner_cron_jobs: - { job: 'docker stop $(docker ps -q) && rsync -avz --delete --exclude cache {{ docker_dir }} {{ mergerfs_root }}/docker_data && {{ snapraid_runner_command }} && docker start $(docker ps -a -q)', name: 'snapraid_runner', weekday: '0', hour: '3' } -snapraid_runner_delete_threshold: 5000 +snapraid_runner_delete_threshold: 999999 snapraid_runner_email_sendon: "error" diff --git a/run.yml b/run.yml index 19da4804..0f197397 100644 --- a/run.yml +++ b/run.yml @@ -15,10 +15,6 @@ become: yes pre_tasks: - - name: Copy persistent data to the server - import_tasks: tasks/copy_persistent_data.yml - tags: containers - - name: Remove snap functionality import_tasks: tasks/yeet_snaps.yml tags: nosnaps diff --git a/tasks/backup_persistent_data.yml b/tasks/backup_persistent_data.yml deleted file mode 100644 index 1f1584c2..00000000 --- a/tasks/backup_persistent_data.yml +++ /dev/null @@ -1,30 +0,0 @@ -- name: Check if the persistent data folder exists on the remote machine - stat: - path: "{{ docker_dir }}" - register: persistent_data_remote - -- name: Get running containers - docker_host_info: - containers: yes - register: docker_info - -- name: Stop running containers - docker_container: - name: "{{ item }}" - state: stopped - loop: "{{ docker_info.containers | map(attribute='Id') | list }}" - -- name: Sync the persistent docker data from the server - synchronize: - mode: pull - delete: yes - src: "{{ docker_dir }}/" - dest: "files/docker_persistent_data/" - when: persistent_data_remote.stat.exists == true - -- name: Start all containers - docker_container: - name: "{{ item }}" - state: started - loop: "{{ docker_info.containers | map(attribute='Id') | list }}" - diff --git a/tasks/copy_persistent_data.yml b/tasks/copy_persistent_data.yml deleted file mode 100644 index dc1c1fb2..00000000 --- a/tasks/copy_persistent_data.yml +++ /dev/null @@ -1,28 +0,0 @@ -- name: Check if the persistent data folder exists on the local machine - become: false - local_action: - module: stat - path: "files/docker_persistent_data/" - register: persistent_data_local - -- name: Check if the persistent data folder exists on the remote machine - stat: - path: "{{ docker_dir }}" - register: persistent_data_remote - -- name: Create the persistent data folder on the remote machine - file: - dest: "{{ docker_dir }}" - state: directory - owner: "{{ username }}" - group: "{{ username }}" - recurse: yes - when: persistent_data_remote.stat.exists == false - -- name: Sync the persistent docker data to the server - synchronize: - mode: push - delete: yes - src: "files/docker_persistent_data/" - dest: "{{ docker_dir }}/" - when: copy_persistent_data and (persistent_data_local.stat.exists == true and persistent_data_remote.stat.exists == false) or force_copy_persistent_data \ No newline at end of file