diff --git a/roles/jellyfin/defaults/main.yml b/roles/jellyfin/defaults/main.yml index 78c1a3c..9494408 100644 --- a/roles/jellyfin/defaults/main.yml +++ b/roles/jellyfin/defaults/main.yml @@ -1,6 +1,7 @@ --- jellyfin_user: jellyfin +jellyfin_version: 10.8.1 jellyfin_base_path: /opt/jellyfin jellyfin_config_path: "{{ jellyfin_base_path }}/config" @@ -10,11 +11,13 @@ 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_image_tag: ~ +jellyfin_container_image_ref: "{{ jellyfin_container_image_name }}:{{ jellyfin_container_image_tag | default(jellyfin_version, true) }}" jellyfin_container_network_mode: host jellyfin_container_networks: ~ jellyfin_container_volumes: "{{ jellyfin_container_base_volumes + jellyfin_media_volumes }}" +jellyfin_container_labels: "{{ jellyfin_container_base_labels | combine(jellyfin_container_extra_labels) }}" +jellyfin_container_extra_labels: {} jellyfin_container_restart_policy: "unless-stopped" jellyfin_host_directories: diff --git a/roles/jellyfin/tasks/main.yml b/roles/jellyfin/tasks/main.yml index 14a8256..eeb287f 100644 --- a/roles/jellyfin/tasks/main.yml +++ b/roles/jellyfin/tasks/main.yml @@ -21,13 +21,18 @@ name: "{{ jellyfin_container_image_ref }}" state: present source: pull - force_source: "{{ jellyfin_container_image_tag in ['stable', 'unstable'] }}" + force_source: "{{ jellyfin_container_image_tag | default(false, true) }}" + register: jellyfin_container_image_pull_result + until: jellyfin_container_image_pull_result is succeeded + retries: 5 + delay: 3 - name: Ensure container '{{ jellyfin_container_name }}' is running docker_container: name: "{{ jellyfin_container_name }}" image: "{{ jellyfin_container_image_ref }}" user: "{{ jellyfin_uid }}:{{ jellyfin_gid }}" + labels: "{{ jellyfin_container_labels }}" volumes: "{{ jellyfin_container_volumes }}" networks: "{{ jellyfin_container_networks | default(omit, True) }}" network_mode: "{{ jellyfin_container_network_mode }}" diff --git a/roles/jellyfin/vars/main.yml b/roles/jellyfin/vars/main.yml index d5e587b..a084685 100644 --- a/roles/jellyfin/vars/main.yml +++ b/roles/jellyfin/vars/main.yml @@ -3,3 +3,6 @@ jellyfin_container_base_volumes: - "{{ jellyfin_config_path }}:/config:z" - "{{ jellyfin_cache_path }}:/cache:z" + +jellyfin_container_base_labels: + version: "{{ jellyfin_version }}"