Initial commit with working nginx and jellyfin

This commit is contained in:
Lukáš Kucharczyk 2021-04-23 01:04:44 +02:00
commit f4310c2e7d
No known key found for this signature in database
GPG Key ID: 65524498C0196B64
7 changed files with 65 additions and 0 deletions

9
group_vars/all Normal file
View File

@ -0,0 +1,9 @@
base_domain: "homelab.cz"
data_folder: "{{ playbook_dir }}/docker-data"
nginx_confd_folder: "{{ data_folder }}/nginx/conf.d"
puid: "1000"
pgid: "1000"
tz: "Europe/Prague"
media:
tv: "{{ data_folder }}/media/tv"
movies: "{{ data_folder }}/media/movies"

1
hosts.localhost Normal file
View File

@ -0,0 +1 @@
localhost ansible_conection=local

5
playbook.yml Normal file
View File

@ -0,0 +1,5 @@
---
- hosts: localhost
roles:
- nginx
- jellyfin

View File

@ -0,0 +1,25 @@
- name: run jellyfin container
docker_container:
name: 'jellyfin'
image: linuxserver/jellyfin
volumes:
- "{{ data_folder }}/jellyfin:/config"
- "{{ media.tv }}:/data/tvshows"
- "{{ media.movies }}:/data/movies"
ports:
- "8096:8096"
- "8920:8920"
- "7359:7359/udp"
- "1900:1900/udp"
env:
PUID={{ puid }}
PGID={{ pgid }}
TZ={{ tz }}
devices:
- /dev/dri:/dev/dri
state: started
- name: copy jellyfin config to nginx
template:
src: jellyfin.conf
dest: "{{ nginx_confd_folder }}"
notify: reload nginx

View File

@ -0,0 +1,11 @@
server {
listen 80;
server_name "jellyfin.{{ base_domain }}";
set $jellyfin 192.168.0.107;
#resolver 127.0.0.1 valid=30;
location / {
proxy_pass http://$jellyfin:8096;
proxy_set_header Host $host;
}
}

View File

@ -0,0 +1,2 @@
- name: reload nginx
command: docker restart nginx

View File

@ -0,0 +1,12 @@
- name: run nginx container
docker_container:
name: 'nginx'
image: nginx
volumes:
- "{{ nginx_confd_folder }}:/etc/nginx/conf.d"
ports:
- "80:80"
env:
NGINX_HOST: "{{ base_domain }}"
NGINX_PORT: '80'
state: started