From c28214c517d68d5e8a960ac3eab1632b7f87ffe6 Mon Sep 17 00:00:00 2001 From: Marius Meyer Date: Mon, 3 Jun 2024 14:02:44 +0200 Subject: [PATCH] move data to /var/lib/gitea --- handlers/backup.yaml | 2 +- tasks/main.yaml | 10 ++++++---- templates/docker-compose.yaml.j2 | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/handlers/backup.yaml b/handlers/backup.yaml index 423c83e..a04fc0b 100644 --- a/handlers/backup.yaml +++ b/handlers/backup.yaml @@ -18,7 +18,7 @@ - name: Backup Gitea directory community.general.archive: - path: /opt/gitea/ + path: /var/lib/gitea/ dest: "/var/backups/gitea-{{ gitea.hostname }}.{{ gitea.domain }}@{{ lookup('pipe', 'date -u +%Y-%m-%dT%H:%M:%SZ') }}.tar.gz" force_archive: true format: gz diff --git a/tasks/main.yaml b/tasks/main.yaml index 67d592d..89738f9 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -10,16 +10,18 @@ name: git register: git_user -- name: Ensure Gitea directory exists +- name: Ensure Gitea directories exist ansible.builtin.file: - path: "/opt/gitea" + path: "{{ item }}" state: directory owner: root mode: "755" + recurse: yes + with_items: ["/opt/gitea", "/var/lib/gitea"] - name: Ensure data directory exists ansible.builtin.file: - path: "/opt/gitea/data" + path: "/var/lib/gitea/data" state: directory owner: "{{ git_user.uid }}" group: "{{ git_user.group }}" @@ -27,7 +29,7 @@ - name: Ensure config directory exists ansible.builtin.file: - path: "/opt/gitea/config" + path: "/var/lib/gitea/config" state: directory owner: "{{ git_user.uid }}" group: "{{ git_user.group }}" diff --git a/templates/docker-compose.yaml.j2 b/templates/docker-compose.yaml.j2 index b844b7f..119ab71 100644 --- a/templates/docker-compose.yaml.j2 +++ b/templates/docker-compose.yaml.j2 @@ -15,8 +15,8 @@ services: image: gitea/gitea:{{ gitea_vars['version'] }}-rootless restart: unless-stopped volumes: - - ./data:/var/lib/gitea - - ./config:/etc/gitea + - /var/lib/gitea/data:/var/lib/gitea + - /var/lib/gitea/config:/etc/gitea - /etc/timezone:/etc/timezone:ro - /etc/localtime:/etc/localtime:ro ports: @@ -40,6 +40,6 @@ services: networks: - gitea volumes: - - ./mysql:/var/lib/mysql + - /var/lib/gitea/mysql:/var/lib/mysql cap_add: - SYS_NICE