From 1414357ad7d43e829ce82003cd9cf5f1f30a6c0f Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 30 Jan 2020 13:43:28 +0000 Subject: [PATCH] Install librespeed --- .../files/librespeed/docker-compose.yml | 16 ++++++++++ ansible/roles/docker/tasks/librespeed.yml | 31 +++++++++++++++++++ ansible/roles/docker/tasks/main.yml | 3 ++ 3 files changed, 50 insertions(+) create mode 100644 ansible/roles/docker/files/librespeed/docker-compose.yml create mode 100644 ansible/roles/docker/tasks/librespeed.yml diff --git a/ansible/roles/docker/files/librespeed/docker-compose.yml b/ansible/roles/docker/files/librespeed/docker-compose.yml new file mode 100644 index 0000000..2cff996 --- /dev/null +++ b/ansible/roles/docker/files/librespeed/docker-compose.yml @@ -0,0 +1,16 @@ +version: "2" +services: + librespeed: + image: linuxserver/librespeed:5.1-ls2 + container_name: librespeed + environment: + - PUID=3000 + - PGID=3000 + - TZ=Europe/London + restart: unless-stopped + labels: + - "traefik.enable=true" + - "traefik.http.routers.librespeed.rule=Host(`speed.jakehoward.tech`)" + - "traefik.http.routers.librespeed.tls=true" + - "traefik.http.routers.librespeed.tls.certresolver=le" + - "traefik.http.routers.librespeed.middlewares=internal-only@file" diff --git a/ansible/roles/docker/tasks/librespeed.yml b/ansible/roles/docker/tasks/librespeed.yml new file mode 100644 index 0000000..b416bc2 --- /dev/null +++ b/ansible/roles/docker/tasks/librespeed.yml @@ -0,0 +1,31 @@ +- name: Create librespeed directory + file: + path: '/opt/librespeed' + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + become_user: root + +- name: Install librespeed compose file + template: + src: files/librespeed/docker-compose.yml + dest: "/opt/librespeed/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 librespeed container + docker_compose: + project_src: /opt/librespeed + 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 a17529f..4cd5bc9 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -21,3 +21,6 @@ - name: Install emby include: emby.yml + +- name: Install librespeed + include: librespeed.yml