From e8496ddced897a1f597478db47fa65bf5e4f1b06 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 1 Feb 2021 17:24:36 +0000 Subject: [PATCH] Deploy deluge in docker Makes version managing so much easier! --- ansible/group_vars/all/pve.yml | 2 ++ ansible/main.yml | 4 ++++ ansible/roles/deluge/files/docker-compose.yml | 24 +++++++++++++++++++ ansible/roles/deluge/handlers/main.yml | 4 ++++ ansible/roles/deluge/tasks/main.yml | 17 +++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 ansible/roles/deluge/files/docker-compose.yml create mode 100644 ansible/roles/deluge/handlers/main.yml create mode 100644 ansible/roles/deluge/tasks/main.yml diff --git a/ansible/group_vars/all/pve.yml b/ansible/group_vars/all/pve.yml index 5ddfc7b..cc5cbca 100644 --- a/ansible/group_vars/all/pve.yml +++ b/ansible/group_vars/all/pve.yml @@ -13,3 +13,5 @@ pve_hosts: ip: 192.168.2.41 forrest: internal_ip: 10.23.1.99 + deluge: + internal_ip: 10.23.1.52 diff --git a/ansible/main.yml b/ansible/main.yml index 2e9e572..a4dd000 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -70,3 +70,7 @@ - hosts: forrest roles: - forrest + +- hosts: deluge + roles: + - deluge diff --git a/ansible/roles/deluge/files/docker-compose.yml b/ansible/roles/deluge/files/docker-compose.yml new file mode 100644 index 0000000..088632d --- /dev/null +++ b/ansible/roles/deluge/files/docker-compose.yml @@ -0,0 +1,24 @@ +version: "2.3" + +services: + deluge: + image: linuxserver/deluge:latest + network_mode: host + environment: + - PUID={{ docker_user.id }} + - PGID={{ docker_user.id }} + - TZ=Europe/London + volumes: + - ./deluge:/config + - /mnt/downloads:/downloads + restart: unless-stopped + + egress: + image: theorangeone/static-server:latest + restart: unless-stopped + environment: + - INDEX=on + volumes: + - /mnt/downloads:/srv:ro + ports: + - 80:80 diff --git a/ansible/roles/deluge/handlers/main.yml b/ansible/roles/deluge/handlers/main.yml new file mode 100644 index 0000000..7bd8472 --- /dev/null +++ b/ansible/roles/deluge/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart deluge + shell: + chdir: /opt/deluge + cmd: "{{ docker_update_command }}" diff --git a/ansible/roles/deluge/tasks/main.yml b/ansible/roles/deluge/tasks/main.yml new file mode 100644 index 0000000..8b5c4e1 --- /dev/null +++ b/ansible/roles/deluge/tasks/main.yml @@ -0,0 +1,17 @@ +- name: Create deluge directory + file: + path: /opt/deluge + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + +- name: Install deluge compose file + template: + src: files/docker-compose.yml + dest: /opt/deluge/docker-compose.yml + mode: "{{ docker_compose_file_mask }}" + owner: "{{ docker_user.name }}" + validate: /usr/bin/docker-compose -f %s config + notify: restart deluge + become: true