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)
This commit is contained in:
Tobias Wüst 2026-05-12 23:34:33 +02:00
parent 123769a4f4
commit f4084ba078
Signed by: Tobias-Wuest
GPG key ID: 2D8992B0F4CA97E8
2 changed files with 9 additions and 10 deletions

View file

@ -8,11 +8,10 @@ docker_volume_base_dir: /srv/data
# homarr-specific configuration # homarr-specific configuration
homarr_base_path: /srv/data/homarr homarr_base_path: /srv/data/homarr
homarr_service_name: homarr homarr_docker_compose_dir: "{{ docker_compose_base_dir }}/homarr"
homarr_docker_compose_dir: "{{ docker_compose_base_dir }}/{{ homarr_service_name }}" homarr_docker_volume_dir: "{{ docker_volume_base_dir }}/homarr"
homarr_docker_volume_dir: "{{ docker_volume_base_dir }}/{{ homarr_service_name }}" homarr_appdata_dir: "{{ homarr_docker_volume_dir }}/homarr/appdata"
homarr_appdata_dir: "{{ homarr_docker_volume_dir }}/{{ homarr_service_name }}/appdata" homarr_db: "{{ homarr_appdata_dir }}/db/db.sqlite"
homarr_db_dir: "{{ homarr_appdata_dir }}/db/db.sqlite"
# Service configuration # Service configuration
homarr_domain: "homarr.local.test" homarr_domain: "homarr.local.test"

View file

@ -47,7 +47,7 @@
- name: Check if database already exists - name: Check if database already exists
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ homarr_db_dir }}" path: "{{ homarr_db }}"
register: db_exists register: db_exists
# ===================================================================== # =====================================================================
@ -71,14 +71,14 @@
- name: Wait for database to be created by Homarr - name: Wait for database to be created by Homarr
ansible.builtin.wait_for: ansible.builtin.wait_for:
path: "{{ homarr_db_dir }}" path: "{{ homarr_db }}"
state: present state: present
timeout: 60 timeout: 60
when: not db_exists.stat.exists when: not db_exists.stat.exists
- name: Wait for database schema to be initialized - name: Wait for database schema to be initialized
ansible.builtin.command: 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 register: schema_check
until: schema_check.stdout == "board" until: schema_check.stdout == "board"
retries: 30 retries: 30
@ -112,14 +112,14 @@
- name: Check if local admin user exists - name: Check if local admin user exists
ansible.builtin.command: 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 register: admin_exists
changed_when: false changed_when: false
failed_when: false failed_when: false
- name: Seed Homarr database - name: Seed Homarr database
ansible.builtin.shell: | ansible.builtin.shell: |
sqlite3 "{{ homarr_db_dir }}" << 'SEEDSQL' sqlite3 "{{ homarr_db }}" << 'SEEDSQL'
BEGIN TRANSACTION; BEGIN TRANSACTION;
-- SERVER SETTINGS -- SERVER SETTINGS