homelab/roles/jellyfin/tasks/main.yml

41 lines
961 B
YAML
Raw Normal View History

- name: Create Jellyfin directory
ansible.builtin.file:
path: "{{ jellyfin_root }}"
state: directory
2023-05-04 05:20:22 +00:00
mode: 0500
- name: Create jellyfin user
2023-05-04 03:42:55 +00:00
ansible.builtin.user:
name: jellyfin
state: present
2023-05-04 05:20:22 +00:00
- name: Get user jellyfin uid
2023-05-04 03:42:55 +00:00
ansible.builtin.getent:
database: passwd
key: jellyfin
2023-05-04 05:20:22 +00:00
- name: Get user jellyfin gid
2023-05-04 03:42:55 +00:00
ansible.builtin.getent:
database: group
key: jellyfin
- name: Install Jellyfin's docker-compose file
2023-05-04 03:42:55 +00:00
ansible.builtin.template:
src: docker-compose.yml.j2
dest: "{{ jellyfin_root }}/docker-compose.yml"
2023-05-04 05:20:22 +00:00
mode: 0400
notify: restart_jellyfin
- name: Install Jellyfin's docker-compose variables
2023-05-04 03:42:55 +00:00
ansible.builtin.template:
src: compose-env.j2
dest: "{{ jellyfin_root }}/.env"
2023-05-04 05:20:22 +00:00
mode: 0400
notify: restart_jellyfin
- name: Start and enable Jellyfin service
2023-05-04 03:42:55 +00:00
ansible.builtin.service:
name: "{{ docker_compose_service }}@{{ jellyfin_name }}"
state: started
enabled: true