From f4084ba078fd8fb82c079e9008c6fbf2c9db8a4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20W=C3=BCst?= Date: Tue, 12 May 2026 23:34:33 +0200 Subject: [PATCH] refactor(homarr): drop service_name var and rename db_dir to db - homarr_service_name removed, replaced with fixed "homarr" string - homarr_db_dir renamed to homarr_db (variable points to a file, not a dir) --- roles/homarr/defaults/main.yml | 9 ++++----- roles/homarr/tasks/main.yml | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/roles/homarr/defaults/main.yml b/roles/homarr/defaults/main.yml index dce7501..2afb9f9 100644 --- a/roles/homarr/defaults/main.yml +++ b/roles/homarr/defaults/main.yml @@ -8,11 +8,10 @@ docker_volume_base_dir: /srv/data # homarr-specific configuration homarr_base_path: /srv/data/homarr -homarr_service_name: homarr -homarr_docker_compose_dir: "{{ docker_compose_base_dir }}/{{ homarr_service_name }}" -homarr_docker_volume_dir: "{{ docker_volume_base_dir }}/{{ homarr_service_name }}" -homarr_appdata_dir: "{{ homarr_docker_volume_dir }}/{{ homarr_service_name }}/appdata" -homarr_db_dir: "{{ homarr_appdata_dir }}/db/db.sqlite" +homarr_docker_compose_dir: "{{ docker_compose_base_dir }}/homarr" +homarr_docker_volume_dir: "{{ docker_volume_base_dir }}/homarr" +homarr_appdata_dir: "{{ homarr_docker_volume_dir }}/homarr/appdata" +homarr_db: "{{ homarr_appdata_dir }}/db/db.sqlite" # Service configuration homarr_domain: "homarr.local.test" diff --git a/roles/homarr/tasks/main.yml b/roles/homarr/tasks/main.yml index 22bfe97..b292408 100644 --- a/roles/homarr/tasks/main.yml +++ b/roles/homarr/tasks/main.yml @@ -47,7 +47,7 @@ - name: Check if database already exists ansible.builtin.stat: - path: "{{ homarr_db_dir }}" + path: "{{ homarr_db }}" register: db_exists # ===================================================================== @@ -71,14 +71,14 @@ - name: Wait for database to be created by Homarr ansible.builtin.wait_for: - path: "{{ homarr_db_dir }}" + path: "{{ homarr_db }}" state: present timeout: 60 when: not db_exists.stat.exists - name: Wait for database schema to be initialized ansible.builtin.command: - cmd: sqlite3 "{{ homarr_db_dir }}" "SELECT name FROM sqlite_master WHERE type='table' AND name='board';" + cmd: sqlite3 "{{ homarr_db }}" "SELECT name FROM sqlite_master WHERE type='table' AND name='board';" register: schema_check until: schema_check.stdout == "board" retries: 30 @@ -112,14 +112,14 @@ - name: Check if local admin user exists ansible.builtin.command: - cmd: sqlite3 "{{ homarr_db_dir }}" "SELECT id FROM user WHERE id='user-local-admin';" + cmd: sqlite3 "{{ homarr_db }}" "SELECT id FROM user WHERE id='user-local-admin';" register: admin_exists changed_when: false failed_when: false - name: Seed Homarr database ansible.builtin.shell: | - sqlite3 "{{ homarr_db_dir }}" << 'SEEDSQL' + sqlite3 "{{ homarr_db }}" << 'SEEDSQL' BEGIN TRANSACTION; -- SERVER SETTINGS