feat(jellyfin): add role for ansible deployment in docker container
This commit is contained in:
parent
e6f9256566
commit
ddebf0618c
@ -11,6 +11,9 @@ concise area of concern.
|
||||
- [`roles/gitea`](roles/gitea/README.md): Deploy [gitea.io](https://gitea.io), a
|
||||
lightweight, self-hosted git service.
|
||||
|
||||
- [`roles/jellyfin`](roles/jellyfin/README.md): Deploy [jellyfin.org](https://jellyfin.org),
|
||||
the free software media system for streaming stored media to any device.
|
||||
|
||||
- [`roles/restic`](roles/restic/README.md): Manage backups using restic
|
||||
and persist them to a configurable backend.
|
||||
|
||||
|
29
roles/jellyfin/defaults/main.yml
Normal file
29
roles/jellyfin/defaults/main.yml
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
|
||||
jellyfin_user: jellyfin
|
||||
|
||||
jellyfin_base_path: /opt/jellyfin
|
||||
jellyfin_config_path: "{{ jellyfin_base_path }}/config"
|
||||
jellyfin_cache_path: "{{ jellyfin_base_path }}/cache"
|
||||
|
||||
jellyfin_media_volumes: []
|
||||
|
||||
jellyfin_container_name: jellyfin
|
||||
jellyfin_container_image_name: "docker.io/jellyfin/jellyfin"
|
||||
jellyfin_container_image_tag: "latest"
|
||||
jellyfin_container_image_ref: "{{ jellyfin_container_image_name }}:{{ jellyfin_container_image_tag }}"
|
||||
jellyfin_container_network_mode: host
|
||||
jellyfin_container_networks: ~
|
||||
jellyfin_container_volumes: "{{ jellyfin_container_base_volumes + jellyfin_media_volumes }}"
|
||||
jellyfin_container_restart_policy: "unless-stopped"
|
||||
|
||||
jellyfin_host_directories:
|
||||
- path: "{{ jellyfin_base_path }}"
|
||||
mode: "0750"
|
||||
- path: "{{ jellyfin_config_path }}"
|
||||
mode: "0750"
|
||||
- path: "{{ jellyfin_cache_path }}"
|
||||
mode: "0750"
|
||||
|
||||
jellyfin_uid: "{{ jellyfin_user_info.uid | default(jellyfin_user) }}"
|
||||
jellyfin_gid: "{{ jellyfin_user_info.group | default(jellyfin_user) }}"
|
35
roles/jellyfin/tasks/main.yml
Normal file
35
roles/jellyfin/tasks/main.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
|
||||
- name: Ensure user '{{ jellyfin_user }}' for jellyfin is created
|
||||
user:
|
||||
name: "{{ jellyfin_user }}"
|
||||
state: present
|
||||
system: yes
|
||||
register: jellyfin_user_info
|
||||
|
||||
- name: Ensure host directories for jellyfin exist
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
owner: "{{ item.owner | default(jellyfin_uid) }}"
|
||||
group: "{{ item.group | default(jellyfin_gid) }}"
|
||||
mode: "{{ item.mode }}"
|
||||
loop: "{{ jellyfin_host_directories }}"
|
||||
|
||||
- name: Ensure container image for jellyfin is available
|
||||
docker_image:
|
||||
name: "{{ jellyfin_container_image_ref }}"
|
||||
state: present
|
||||
source: pull
|
||||
force_source: "{{ jellyfin_container_image_tag in ['stable', 'unstable'] }}"
|
||||
|
||||
- name: Ensure container '{{ jellyfin_container_name }}' is running
|
||||
docker_container:
|
||||
name: "{{ jellyfin_container_name }}"
|
||||
image: "{{ jellyfin_container_image_ref }}"
|
||||
user: "{{ jellyfin_uid }}:{{ jellyfin_gid }}"
|
||||
volumes: "{{ jellyfin_container_volumes }}"
|
||||
networks: "{{ jellyfin_container_networks | default(omit, True) }}"
|
||||
network_mode: "{{ jellyfin_container_network_mode }}"
|
||||
restart_policy: "{{ jellyfin_container_restart_policy }}"
|
||||
state: started
|
5
roles/jellyfin/vars/main.yml
Normal file
5
roles/jellyfin/vars/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
jellyfin_container_base_volumes:
|
||||
- "{{ jellyfin_config_path }}:/config:z"
|
||||
- "{{ jellyfin_cache_path }}:/cache:z"
|
Loading…
Reference in New Issue
Block a user