feat(ansible): add Jellyfin service and improve deployment
- Add Jellyfin backend to HAProxy configuration on titania.incus - Simplify deployment by using community.docker.docker_compose_v2 module - Consolidate handlers and remove redundant Docker commands - Update Jellyfin systemd service from oneshot to simple type - Remove PUID/PGID environment variables from docker-compose template
This commit is contained in:
@@ -74,6 +74,12 @@ haproxy_backends:
|
|||||||
backend_port: 22084
|
backend_port: 22084
|
||||||
health_path: "/api/ping"
|
health_path: "/api/ping"
|
||||||
|
|
||||||
|
- subdomain: "jellyfin"
|
||||||
|
backend_host: "rosalind.incus"
|
||||||
|
backend_port: 22086
|
||||||
|
health_path: "/health"
|
||||||
|
timeout_server: 300s
|
||||||
|
|
||||||
- subdomain: "arke"
|
- subdomain: "arke"
|
||||||
backend_host: "sycorax.incus"
|
backend_host: "sycorax.incus"
|
||||||
backend_port: 25540
|
backend_port: 25540
|
||||||
|
|||||||
@@ -46,11 +46,6 @@
|
|||||||
- "{{ jellyfin_config_dir }}"
|
- "{{ jellyfin_config_dir }}"
|
||||||
- "{{ jellyfin_cache_dir }}"
|
- "{{ jellyfin_cache_dir }}"
|
||||||
|
|
||||||
- name: Check if Docker is installed
|
|
||||||
ansible.builtin.stat:
|
|
||||||
path: /var/run/docker.sock
|
|
||||||
register: docker_socket
|
|
||||||
|
|
||||||
- name: Deploy Docker Compose configuration
|
- name: Deploy Docker Compose configuration
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
@@ -59,9 +54,7 @@
|
|||||||
group: "{{ jellyfin_group }}"
|
group: "{{ jellyfin_group }}"
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
notify:
|
notify:
|
||||||
- Stop Jellyfin
|
- Restart Jellyfin
|
||||||
- Pull Jellyfin image
|
|
||||||
- Start Jellyfin
|
|
||||||
|
|
||||||
- name: Create systemd service for Docker Compose
|
- name: Create systemd service for Docker Compose
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
@@ -71,33 +64,19 @@
|
|||||||
notify:
|
notify:
|
||||||
- Reload systemd
|
- Reload systemd
|
||||||
- Enable Jellyfin
|
- Enable Jellyfin
|
||||||
- Start Jellyfin
|
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
- name: Reload systemd
|
- name: Reload systemd
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
- name: Stop Jellyfin
|
- name: Restart Jellyfin
|
||||||
ansible.builtin.command:
|
community.docker.docker_compose_v2:
|
||||||
cmd: "docker compose down"
|
project_src: "{{ jellyfin_directory }}"
|
||||||
chdir: "{{ jellyfin_directory }}"
|
pull: always
|
||||||
become_user: "{{ jellyfin_user }}"
|
state: present
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Pull Jellyfin image
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: "docker compose pull"
|
|
||||||
chdir: "{{ jellyfin_directory }}"
|
|
||||||
become_user: "{{ jellyfin_user }}"
|
become_user: "{{ jellyfin_user }}"
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Start Jellyfin
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: "docker compose up -d"
|
|
||||||
chdir: "{{ jellyfin_directory }}"
|
|
||||||
become_user: "{{ jellyfin_user }}"
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Enable Jellyfin
|
- name: Enable Jellyfin
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ services:
|
|||||||
syslog-address: "udp://prospero.incus:1514"
|
syslog-address: "udp://prospero.incus:1514"
|
||||||
tag: "jellyfin"
|
tag: "jellyfin"
|
||||||
environment:
|
environment:
|
||||||
- PUID={{ jellyfin_uid }}
|
|
||||||
- PGID={{ jellyfin_gid }}
|
|
||||||
- TZ=America/Toronto
|
- TZ=America/Toronto
|
||||||
- JELLYFIN_PublishedServerUrl={{ jellyfin_published_server_url }}
|
- JELLYFIN_PublishedServerUrl={{ jellyfin_published_server_url }}
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
|
|||||||
@@ -5,14 +5,13 @@ After=docker.service
|
|||||||
Requires=docker.service
|
Requires=docker.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=simple
|
||||||
RemainAfterExit=yes
|
|
||||||
WorkingDirectory={{ jellyfin_directory }}
|
WorkingDirectory={{ jellyfin_directory }}
|
||||||
User={{ jellyfin_user }}
|
User={{ jellyfin_user }}
|
||||||
ExecStart=/usr/bin/docker compose up -d
|
ExecStart=/usr/bin/docker compose up --remove-orphans
|
||||||
ExecStop=/usr/bin/docker compose down
|
ExecStop=/usr/bin/docker compose down
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
Reference in New Issue
Block a user