chore: base config and deployment for role homarr

This commit is contained in:
Tobias Wüst 2026-01-23 15:45:59 +01:00
parent 129121f3f2
commit ece5b4ccf9
Signed by: Tobias-Wuest
GPG key ID: 2D8992B0F4CA97E8
3 changed files with 69 additions and 2 deletions

View file

@ -1,3 +1,23 @@
#SPDX-License-Identifier: MIT-0
---
# defaults file for homarr
# defaults file for homarr
# Base directory configuration (inherited from base role or defined here)
docker_compose_base_dir: /etc/docker/compose
docker_volume_base_dir: /srv/data
# homarr-specific configuration
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 }}"
# Service configuration
homarr_domain: "homarr.local.test"
homarr_image: "ghcr.io/homarr-labs/homarr:latest"
homarr_secret_encription_key: "CHANGE_ME"
homarr_port: 7575
homarr_use_docker: false
# Traefik configuration
homarr_traefik_network: "proxy"
homarr_use_ssl: true

View file

@ -1,3 +1,19 @@
#SPDX-License-Identifier: MIT-0
---
# tasks file for homarr
# tasks file for homarr
- name: Create docker compose directory
file:
path: "{{ homarr_docker_compose_dir }}"
state: directory
mode: '0755'
- name: Create docker-compose file for homarr
template:
src: docker-compose.yml.j2
dest: "{{ homarr_docker_compose_dir }}/docker-compose.yml"
mode: '0644'
- name: Start homarr containers
community.docker.docker_compose_v2:
project_src: "{{ homarr_docker_compose_dir }}"
state: present

View file

@ -0,0 +1,31 @@
#---------------------------------------------------------------------#
# Homarr - A simple, yet powerful dashboard for your server. #
#---------------------------------------------------------------------#
services:
homarr:
container_name: {{ homarr_service_name }}
image: {{ homarr_image }}
restart: unless-stopped
volumes:
{% if homarr_use_docker %}
- /var/run/docker.sock:/var/run/docker.sock # Optional, only if you want docker integration
{% endif %}
- {{ homarr_docker_volume_dir }}/homarr/appdata:/appdata
environment:
- SECRET_ENCRYPTION_KEY={{ homarr_secret_encryption_key }}
networks:
- {{ homarr_traefik_network }}
labels:
- traefik.enable=true
- traefik.docker.network={{ homarr_traefik_network }}
- traefik.http.routers.{{ homarr_service_name }}.rule=Host(`{{ homarr_domain }}`)
{% if homarr_use_ssl %}
- traefik.http.routers.{{ homarr_service_name }}.entrypoints=websecure
- traefik.http.routers.{{ homarr_service_name }}.tls=true
{% else %}
- traefik.http.routers.{{ homarr_service_name }}.entrypoints=web
{% endif %}
- traefik.http.services.{{ homarr_service_name }}.loadbalancer.server.port={{ homarr_port }}
networks:
{{ homarr_traefik_network }}:
external: true