chore: base config and deployment for role homarr
This commit is contained in:
parent
029b1a86d4
commit
d3bdb1fdec
3 changed files with 69 additions and 2 deletions
|
|
@ -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
|
||||
|
|
@ -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
|
||||
31
roles/homarr/templates/docker-compose.yml.j2
Normal file
31
roles/homarr/templates/docker-compose.yml.j2
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue