2022-03-17 14:12:56 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- 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
|
2022-07-17 13:59:19 +00:00
|
|
|
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
|
2022-03-17 14:12:56 +00:00
|
|
|
|
|
|
|
- name: Ensure container '{{ jellyfin_container_name }}' is running
|
|
|
|
docker_container:
|
|
|
|
name: "{{ jellyfin_container_name }}"
|
|
|
|
image: "{{ jellyfin_container_image_ref }}"
|
|
|
|
user: "{{ jellyfin_uid }}:{{ jellyfin_gid }}"
|
2022-07-17 13:59:19 +00:00
|
|
|
labels: "{{ jellyfin_container_labels }}"
|
2022-03-17 14:12:56 +00:00
|
|
|
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
|