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

@ -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