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