forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from anarion80/add_homarr
✨ Add Homarr
- Loading branch information
Showing
11 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,6 +278,10 @@ | |
tags: | ||
- hello_world | ||
|
||
- role: homarr | ||
tags: | ||
- homarr | ||
|
||
- role: homeassistant | ||
tags: | ||
- homeassistant | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
homarr_enabled: false | ||
homarr_available_externally: false | ||
|
||
# directories | ||
homarr_data_directory: "{{ docker_home }}/homarr" | ||
|
||
# network | ||
homarr_port: "7575" | ||
homarr_hostname: "homarr" | ||
|
||
# specs | ||
homarr_memory: 1g | ||
|
||
# docker | ||
homarr_container_name: homarr | ||
homarr_image_name: "ghcr.io/ajnart/homarr" | ||
homarr_image_version: latest | ||
homarr_user_id: "1000" | ||
homarr_group_id: "1000" | ||
|
||
# homarr | ||
homarr_database_url: "file:/data/db.sqlite" | ||
|
||
# Next Auth | ||
# You can generate a new secret on the command line with: | ||
# openssl rand -base64 32 | ||
# https://next-auth.js.org/configuration/options#secret | ||
homarr_nextauth_url: "http://localhost:7575" | ||
|
||
homarr_nextauth_secret: "anything" | ||
|
||
# Disable analytics | ||
homarr_next_public_disable_analytics: "true" | ||
|
||
homarr_default_color_scheme: "light" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Homarr | ||
|
||
Homepage: [https://github.com/ajnart/homarr](https://github.com/ajnart/homarr) | ||
|
||
Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr) | ||
|
||
## Usage | ||
|
||
Set `homarr_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
homarr web interface can be found at [http://ansible_nas_host_or_ip:7575](http://ansible_nas_host_or_ip:7575). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
homarr_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Stop | ||
hosts: all | ||
become: true | ||
tasks: | ||
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role" | ||
ansible.builtin.include_role: | ||
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" | ||
vars: | ||
homarr_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Include vars | ||
ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Get homarr container state | ||
community.docker.docker_container: | ||
name: "{{ homarr_container_name }}" | ||
register: result | ||
|
||
- name: Check if homarr containers are running | ||
ansible.builtin.assert: | ||
that: | ||
- result.container['State']['Status'] == "running" | ||
- result.container['State']['Restarting'] == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Include vars | ||
ansible.builtin.include_vars: | ||
file: ../../defaults/main.yml | ||
|
||
- name: Try and stop and remove homarr | ||
community.docker.docker_container: | ||
name: "{{ homarr_container_name }}" | ||
state: absent | ||
register: result | ||
|
||
- name: Check if homarr is stopped | ||
ansible.builtin.assert: | ||
that: | ||
- not result.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../requirements.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
- name: Start Homarr | ||
block: | ||
- name: Create Homarr Directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
with_items: | ||
- "{{ homarr_data_directory }}" | ||
|
||
- name: Create Homarr Docker Container | ||
community.docker.docker_container: | ||
container_default_behavior: no_defaults | ||
name: "{{ homarr_container_name }}" | ||
image: "{{ homarr_image_name }}:{{ homarr_image_version }}" | ||
pull: true | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock # Optional, only if you want docker integration | ||
- "{{ homarr_data_directory }}/configs:/app/data/configs" | ||
- "{{ homarr_data_directory }}/icons:/app/public/icons" | ||
- "{{ homarr_data_directory }}/data:/data" | ||
ports: | ||
- "{{ homarr_port }}:7575" | ||
env: | ||
TZ: "{{ ansible_nas_timezone }}" | ||
UID: "{{ homarr_user_id | quote }}" | ||
GID: "{{ homarr_group_id | quote }}" | ||
DATABASE_URL: "{{ homarr_database_url }}" | ||
|
||
# Next Auth | ||
# You can generate a new secret on the command line with: | ||
# openssl rand -base64 32 | ||
# https://next-auth.js.org/configuration/options#secret | ||
NEXTAUTH_URL: "{{ homarr_nextauth_url }}" | ||
NEXTAUTH_SECRET: "{{ homarr_nextauth_secret }}" | ||
# Disable analytics | ||
NEXT_PUBLIC_DISABLE_ANALYTICS: "{{ homarr_next_public_disable_analytics }}" | ||
DEFAULT_COLOR_SCHEME: "{{ homarr_default_color_scheme }}" | ||
restart_policy: unless-stopped | ||
memory: "{{ homarr_memory }}" | ||
labels: | ||
traefik.enable: "{{ homarr_available_externally | string }}" | ||
traefik.http.routers.homarr.rule: "Host(`{{ homarr_hostname }}.{{ ansible_nas_domain }}`)" | ||
traefik.http.routers.homarr.tls.certresolver: "letsencrypt" | ||
traefik.http.routers.homarr.tls.domains[0].main: "{{ ansible_nas_domain }}" | ||
traefik.http.routers.homarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" | ||
traefik.http.services.homarr.loadbalancer.server.port: "7575" | ||
when: homarr_enabled is true | ||
|
||
- name: Stop Homarr | ||
block: | ||
- name: Stop Homarr | ||
community.docker.docker_container: | ||
name: "{{ homarr_container_name }}" | ||
state: absent | ||
when: homarr_enabled is false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: "Homarr" | ||
description: "Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr)" | ||
--- | ||
|
||
Homepage: [https://github.com/ajnart/homarr](https://github.com/ajnart/homarr) | ||
|
||
Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr) | ||
|
||
## Usage | ||
|
||
Set `homarr_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file. | ||
|
||
homarr web interface can be found at [http://ansible_nas_host_or_ip:7575](http://ansible_nas_host_or_ip:7575). |