diff --git a/ansible/roles/docker/files/emby/docker-compose.yml b/ansible/roles/docker/files/emby/docker-compose.yml new file mode 100644 index 0000000..8d88772 --- /dev/null +++ b/ansible/roles/docker/files/emby/docker-compose.yml @@ -0,0 +1,22 @@ +version: "2.3" + +services: + emby: + image: linuxserver/emby:4.3.1.0-ls26 + container_name: emby + environment: + - PUID=3000 + - PGID=3000 + - TZ=Europe/London + volumes: + - ./config:/config + - /mnt/media/TV:/mnt/TV + - /mnt/media/Movies:/mnt/Movies + ports: + - 8096:8096 + restart: unless-stopped + labels: + - "traefik.enable=true" + - "traefik.http.routers.emby.rule=Host(`media.jakehoward.tech`)" + - "traefik.http.routers.emby.tls=true" + - "traefik.http.routers.emby.tls.certresolver=le" diff --git a/ansible/roles/docker/tasks/emby.yml b/ansible/roles/docker/tasks/emby.yml new file mode 100644 index 0000000..b66f1c0 --- /dev/null +++ b/ansible/roles/docker/tasks/emby.yml @@ -0,0 +1,31 @@ +- name: Create emby directory + file: + path: '/opt/emby' + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + become_user: root + +- name: Install emby compose file + template: + src: files/emby/docker-compose.yml + dest: "/opt/emby/docker-compose.yml" + mode: "{{ docker_compose_file_mask }}" + owner: "{{ docker_user.name }}" + validate: /usr/bin/docker-compose -f %s config + register: compose_file + become: true + become_user: root + +- name: Cycle emby container + docker_compose: + project_src: /opt/emby + pull: true + remove_orphans: true + remove_volumes: true + state: "{{ item }}" + when: compose_file.changed + loop: + - absent + - present diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index 8fdc4e9..a17529f 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -18,3 +18,6 @@ - name: Install whoami include: whoami.yml + +- name: Install emby + include: emby.yml