From 3efc266ffede9e035ad7e9af92fa22f0f0d742d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Mon, 23 Dec 2024 03:43:27 +0200 Subject: [PATCH] Tasks Update: Backup - Fix backing up Minecraft server --- tasks/backup.yml | 25 ++++++++++++++++++++++--- tasks/deployer.yml | 2 +- tasks/installer.yml | 16 ++++++++-------- tasks/maintenance.yml | 4 ++-- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/tasks/backup.yml b/tasks/backup.yml index c15f400..debd6ce 100644 --- a/tasks/backup.yml +++ b/tasks/backup.yml @@ -4,15 +4,34 @@ name: minecraft state: stopped +- name: "Backup - Minecraft - Create Directory" + ansible.builtin.file: + path: ~/data/backups/tmp + state: directory + +- name: "Backup - Minecraft - Copy" + ansible.builtin.copy: + src: "~/data/minecraft" + dest: "~/data/backups/tmp/minecraft" + follow: true + +- name: "Backup - Minecraft - Delete" + ansible.builtin.file: + path: ~/data/backups/tmp/minecraft/plugins/dynmap/web/tiles + state: absent + - name: "Backup - Minecraft - Save" community.general.archive: path: - - "~/data/minecraft" - exclude_path: - - "~/data/minecraft/plugins/dynmap/web/tiles" + - "~/data/backups/tmp/minecraft" dest: "~/data/backups/minecraft-{{ ansible_facts.date_time.date }}.zip" format: zip +- name: "Backup - Minecraft - Clean" + ansible.builtin.file: + path: ~/data/backups/tmp/minecraft + state: absent + - name: "Backup - Minecraft - Start" containers.podman.podman_container: name: minecraft diff --git a/tasks/deployer.yml b/tasks/deployer.yml index 7fca5f2..13e83cb 100644 --- a/tasks/deployer.yml +++ b/tasks/deployer.yml @@ -17,7 +17,7 @@ - tls - name: "Deployer - Certbot - Copy Certificates" - copy: + ansible.builtin.copy: src: "~/data/certbot/live/{{ cert }}/" dest: "~/data/certificates/{{ cert }}/" follow: true diff --git a/tasks/installer.yml b/tasks/installer.yml index dad4dee..08eee0f 100644 --- a/tasks/installer.yml +++ b/tasks/installer.yml @@ -1,6 +1,6 @@ --- - name: "Installer - Ansible - Python Library" - pip: + ansible.builtin.pip: name: ansible state: latest extra_args: --upgrade @@ -10,7 +10,7 @@ - ansible - name: "Installer : Ansible : Create Folder" - file: + ansible.builtin.file: path: ~/bin state: directory tags: @@ -42,7 +42,7 @@ - ansible - name: "Installer - Ansible - Dependencies / Python Libraries" - pip: + ansible.builtin.pip: name: "{{ library }}" state: latest extra_args: --upgrade @@ -62,14 +62,14 @@ loop_var: "library" - name: "Installer : Certbot : Auth Hook - Create Folder" - file: + ansible.builtin.file: path: ~/data/certbot/auth-hooks state: directory tags: - certbot - name: "Installer : Certbot : Auth Hook - Download" - get_url: + ansible.builtin.get_url: url: "https://git.waren.io/warengroup/acme-dns-auth/raw/branch/master/acme-dns-auth.py" dest: "~/data/certbot/auth-hooks/acme-dns.py" mode: '700' @@ -104,7 +104,7 @@ - certbot - name: "Installer : Schedule : Maintenance" - cron: + ansible.builtin.cron: name: "Matte - Infra - Maintenance" hour: "*/3" minute: "0" @@ -113,7 +113,7 @@ - cron - name: "Installer : Schedule : Deployer" - cron: + ansible.builtin.cron: name: "Matte - Infra - Deployer" minute: "*/5" job: "~/.venv/ansible/bin/ansible-pull -U ssh://git@github.com/MatteZ02/infra -d ~/.ansible/pull/matte/infra --accept-host-key --private-key ~/.ssh/keys/matte/infra --vault-password-file ~/.ansible/vault/matte.yml tasks.yml -t deployer" @@ -121,7 +121,7 @@ - cron - name: "Installer : Schedule : Backup" - cron: + ansible.builtin.cron: name: "Matte - Infra - Backup" hour: "5" minute: "0" diff --git a/tasks/maintenance.yml b/tasks/maintenance.yml index 7cd4414..a65dcc7 100644 --- a/tasks/maintenance.yml +++ b/tasks/maintenance.yml @@ -1,6 +1,6 @@ --- - name: "Installer - Ansible - Dependencies / Python Libraries" - pip: + ansible.builtin.pip: name: "{{ library }}" state: latest extra_args: --upgrade @@ -20,7 +20,7 @@ loop_var: "library" - name: "Maintenance : Ansible : Update" - pip: + ansible.builtin.pip: name: ansible state: latest extra_args: --upgrade