Configurable workdirs and paths.
All checks were successful
Test the role / test-the-role (push) Successful in 8s

This commit is contained in:
Tom
2026-02-23 19:04:02 +01:00
parent 39ca068451
commit d0245e00b7
6 changed files with 31 additions and 16 deletions

View File

@@ -33,6 +33,11 @@ gitea_user: git
gitea_group: git gitea_group: git
gitea_http_port: 3000 gitea_http_port: 3000
gitea_ssh_port: 22 gitea_ssh_port: 22
gitea_work_path: /var/lib/gitea
gitea_app_data_path: /var/lib/gitea/data
gitea_repo_root: /var/lib/gitea/data/gitea-repositories
gitea_lfs_path: /var/lib/gitea/data/lfs
gitea_log_path: /var/lib/gitea/log
gitea_require_signin_view: true gitea_require_signin_view: true
gitea_disable_registration: true gitea_disable_registration: true
gitea_register_manual_confirm: false gitea_register_manual_confirm: false
@@ -64,6 +69,11 @@ gitea_default_keep_email_private: true
| gitea_domain | string | Domain to reach Gitea | | gitea_domain | string | Domain to reach Gitea |
| gitea_http_port | int | HTTP port | | gitea_http_port | int | HTTP port |
| gitea_ssh_port | int | SSH port | | gitea_ssh_port | int | SSH port |
| gitea_work_path | string | Workdir |
| gitea_app_data_path | string | Application data path |
| gitea_repo_root | string | Repo root path |
| gitea_lfs_path | string | LFS path |
| gitea_log_path | string | Log path |
| gitea_root_url | string | Protocol + FQDN + port | | gitea_root_url | string | Protocol + FQDN + port |
| gitea_lfs_jwt_secret | string | LFS storage secret | | gitea_lfs_jwt_secret | string | LFS storage secret |
| gitea_internal_token | string | Internal token | | gitea_internal_token | string | Internal token |

View File

@@ -3,6 +3,11 @@ gitea_user: git
gitea_group: git gitea_group: git
gitea_http_port: 3000 gitea_http_port: 3000
gitea_ssh_port: 22 gitea_ssh_port: 22
gitea_work_path: /var/lib/gitea
gitea_app_data_path: /var/lib/gitea/data
gitea_repo_root: /var/lib/gitea/data/gitea-repositories
gitea_lfs_path: /var/lib/gitea/data/lfs
gitea_log_path: /var/lib/gitea/log
gitea_require_signin_view: true gitea_require_signin_view: true
gitea_disable_registration: true gitea_disable_registration: true
gitea_register_manual_confirm: false gitea_register_manual_confirm: false

View File

@@ -130,7 +130,7 @@
- name: Create the data dir base - name: Create the data dir base
ansible.builtin.file: ansible.builtin.file:
path: /var/lib/gitea path: "{{ gitea_work_path }}"
owner: "{{ gitea_user }}" owner: "{{ gitea_user }}"
group: "{{ gitea_group }}" group: "{{ gitea_group }}"
mode: '0750' mode: '0750'
@@ -144,9 +144,9 @@
mode: '0750' mode: '0750'
state: directory state: directory
loop: loop:
- /var/lib/gitea/custom - "{{ gitea_work_path }}/custom"
- /var/lib/gitea/data - "{{ gitea_app_data_path }}"
- /var/lib/gitea/log - "{{ gitea_log_path }}"
- name: Create the config dir - name: Create the config dir
ansible.builtin.file: ansible.builtin.file:

View File

@@ -1,7 +1,7 @@
--- ---
- name: Create the certs directory - name: Create the certs directory
ansible.builtin.file: ansible.builtin.file:
path: /var/lib/gitea/certs path: "{{ gitea_work_path }}/certs"
owner: "{{ gitea_user }}" owner: "{{ gitea_user }}"
group: "{{ gitea_group }}" group: "{{ gitea_group }}"
mode: '0750' mode: '0750'
@@ -11,9 +11,9 @@
ansible.builtin.command: > ansible.builtin.command: >
gitea cert gitea cert
--host {{ gitea_domain }},{{ gitea_ssh_domain }} --host {{ gitea_domain }},{{ gitea_ssh_domain }}
--out /var/lib/gitea/certs/cert.pem --out {{ gitea_work_path }}/certs/cert.pem
--keyout /var/lib/gitea/certs/key.pem --keyout {{ gitea_work_path }}/certs/key.pem
become: true become: true
become_user: "{{ gitea_user }}" become_user: "{{ gitea_user }}"
args: args:
creates: /var/lib/gitea/certs/cert.pem creates: "{{ gitea_work_path }}/certs/cert.pem"

View File

@@ -2,7 +2,7 @@
APP_NAME = {{ gitea_app_name }} APP_NAME = {{ gitea_app_name }}
RUN_USER = {{ gitea_user }} RUN_USER = {{ gitea_user }}
WORK_PATH = /var/lib/gitea WORK_PATH = {{ gitea_work_path }}
RUN_MODE = prod RUN_MODE = prod
{% if gitea_database_server | default('') == "postgresql" %} {% if gitea_database_server | default('') == "postgresql" %}
@@ -22,19 +22,19 @@ USER = {{ gitea_user }}
PASSWD = PASSWD =
SCHEMA = SCHEMA =
SSL_MODE = disable SSL_MODE = disable
PATH = /var/lib/gitea/data/gitea.db PATH = {{ gitea_app_data_path }}/gitea.db
LOG_SQL = false LOG_SQL = false
{% endif %} {% endif %}
[repository] [repository]
ROOT = /var/lib/gitea/data/gitea-repositories ROOT = {{ gitea_repo_root }}
[server] [server]
SSH_DOMAIN = {{ gitea_ssh_domain }} SSH_DOMAIN = {{ gitea_ssh_domain }}
DOMAIN = {{ gitea_domain }} DOMAIN = {{ gitea_domain }}
HTTP_PORT = {{ gitea_http_port }} HTTP_PORT = {{ gitea_http_port }}
ROOT_URL = {{ gitea_root_url }} ROOT_URL = {{ gitea_root_url }}
APP_DATA_PATH = /var/lib/gitea/data APP_DATA_PATH = {{ gitea_app_data_path }}
DISABLE_SSH = false DISABLE_SSH = false
SSH_PORT = {{ gitea_ssh_port }} SSH_PORT = {{ gitea_ssh_port }}
LFS_START_SERVER = true LFS_START_SERVER = true
@@ -42,7 +42,7 @@ LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }}
OFFLINE_MODE = true OFFLINE_MODE = true
[lfs] [lfs]
PATH = /var/lib/gitea/data/lfs PATH = {{ gitea_lfs_path }}
[mailer] [mailer]
ENABLED = false ENABLED = false
@@ -73,7 +73,7 @@ PROVIDER = file
[log] [log]
MODE = console MODE = console
LEVEL = info LEVEL = info
ROOT_PATH = /var/lib/gitea/log ROOT_PATH = {{ gitea_log_path }}
[repository.pull-request] [repository.pull-request]
DEFAULT_MERGE_STYLE = merge DEFAULT_MERGE_STYLE = merge

View File

@@ -13,10 +13,10 @@ RestartSec=2s
Type=simple Type=simple
User={{ gitea_user }} User={{ gitea_user }}
Group={{ gitea_group }} Group={{ gitea_group }}
WorkingDirectory=/var/lib/gitea/ WorkingDirectory={{ gitea_work_path }}
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always Restart=always
Environment=USER={{ gitea_user }} HOME=/home/{{ gitea_user }} GITEA_WORK_DIR=/var/lib/gitea Environment=USER={{ gitea_user }} HOME=/home/{{ gitea_user }} GITEA_WORK_DIR={{ gitea_work_path }}
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target