Role works.

This commit is contained in:
Laur Ivan 2022-09-28 09:30:25 +02:00
parent 905a0bb291
commit 0b5c81b359
10 changed files with 188 additions and 40 deletions

View File

@ -1,2 +1,51 @@
---
# defaults file for arrs
# defaults file for arrs
# Common defaults
#
timezone: 'Europe/Brussels'
torrent_downloads_volume: '/mnt/download'
arrs_configuration_volume: '/mnt/config'
arrs_setup_path: '~/arrs'
arrs_uid:
arrs_gid:
deluge_enabled: true
sonarr_enabled: true
lidarr_enabled: true
jackett_enabled: true
# Deluge torrent
#
deluge_image_version: 'latest'
deluge_loglevel: 'warning'
deluge_host_port: 6881
deluge_admin_port: 8112
deluge_config_volume: '{{ arrs_configuration_volume }}/deluge'
# Sonarr
#
sonarr_image_version: 'latest'
sonarr_host_port: 8989
sonarr_config_volume: '{{ arrs_configuration_volume }}/sonarr'
sonarr_series_volume: '/mnt/videos/Series'
# Lidarr
lidarr_image_version: 'latest'
lidarr_host_port: 8686
lidarr_config_volume: '{{ arrs_configuration_volume }}/lidarr'
lidarr_music_upload_volume: '/mnt/music/Reference'
lidarr_music_volumes:
- {path: '/mnt/music/Sonos', alias: 'sonos' }
- {path: '/mnt/music/Audiophile', alias: 'audiophile' }
- {path: '/mnt/music/Raw', alias: 'raw' }
# Jakett
jackett_image_version: 'latest'
jackett_auto_update: true
jackett_host_port: 9117
jackett_config_volume: '{{ arrs_configuration_volume }}/jackett'

View File

@ -2,7 +2,7 @@ galaxy_info:
author: Laur Ivan
namespace: laurivan
role_name: arrs
description: Sonarr, Lidarr, Deluge and proxy via Docker
description: Sonarr, Lidarr, Deluge and Jackett via Docker
license: MIT
min_ansible_version: "2.4"
@ -29,7 +29,7 @@ galaxy_info:
- sonarr
- lidarr
- deluge
- proxy
- jackett
- media
- grabber
- docker

View File

@ -5,7 +5,7 @@
tasks:
- name: Check if the docker-compose file exists.
ansible.builtin.stat:
path: "~/plausible/docker-compose.yml"
path: "~/arrs/docker-compose.yml"
register: docker_compose_file
- name: Remove docker-compose.

View File

@ -1,35 +0,0 @@
---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ molecule_no_log }}"
tasks:
# TODO: Developer must implement and populate 'server' variable
- when: server.changed | default(false) | bool
block:
- name: Populate instance config dict
ansible.builtin.set_fact:
instance_conf_dict: {
'instance': "{{ }}",
'address': "{{ }}",
'user': "{{ }}",
'port': "{{ }}",
'identity_file': "{{ }}", }
with_items: "{{ server.results }}"
register: instance_config_dict
- name: Convert instance config dict to a list
ansible.builtin.set_fact:
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}"
- name: Dump instance config
ansible.builtin.copy:
content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
mode: 0600

View File

@ -1,2 +1,38 @@
---
# tasks file for arrs
# tasks file for arrs
- name: Set up directories
ansible.builtin.file:
state: directory
path: "{{ item }}"
owner: "{{ ansible_effective_user_id }}"
group: "{{ ansible_effective_group_id }}"
mode: "0750"
with_items:
- "{{ deluge_config_volume }}"
- "{{ sonarr_config_volume }}"
- "{{ lidarr_config_volume }}"
- "{{ jackett_config_volume }}"
- "{{ arrs_setup_path }}"
tags:
- configuration
become: true
- name: Write configuration files
ansible.builtin.template:
src: "{{ item }}.j2"
dest: "{{ arrs_setup_path }}/{{ item }}"
mode: '0640'
loop:
- "docker-compose.yml"
- "env.deluge.conf"
- "env.sonarr.conf"
- "env.lidarr.conf"
- "env.jackett.conf"
tags:
- configuration
- name: Ensure all requested components are running.
community.docker.docker_compose:
project_src: "{{ arrs_setup_path }}"
build: false
become: false

View File

@ -0,0 +1,67 @@
version: "3.3"
services:
{% if deluge_enabled %}
deluge:
image: "linuxserver/deluge:{{ deluge_image_version }}"
restart: always
env_file:
- {{ arrs_setup_path }}/env.deluge.conf
volumes:
- {{ deluge_config_volume }}:/config
- {{ torrent_downloads_volume }}:/downloads
ports:
- {{ deluge_admin_port }}:8112
- {{ deluge_host_port }}:6881
- {{ deluge_host_port }}:6881/udp
networks:
- arrs
{% endif %}
{% if sonarr_enabled %}
sonarr:
image: "lscr.io/linuxserver/sonarr:{{ sonarr_image_version }}"
restart: always
env_file:
- {{ arrs_setup_path }}/env.sonarr.conf
volumes:
- {{ sonarr_config_volume }}:/config
- {{ sonarr_series_volume }}:/tv
- {{ torrent_downloads_volume }}:/downloads
ports:
- {{ sonarr_host_port }}:8989
networks:
- arrs
{% endif %}
{% if lidarr_enabled %}
lidarr:
image: "lscr.io/linuxserver/lidarr:{{ lidarr_image_version }}"
restart: always
env_file:
- {{ arrs_setup_path }}/env.sonarr.conf
volumes:
- {{ lidarr_config_volume }}:/config
- {{ torrent_downloads_volume }}:/downloads
ports:
- {{ lidarr_host_port }}:8686
networks:
- arrs
{% endif %}
{% if jackett_enabled %}
jackett:
image: "lscr.io/linuxserver/jackett:{{ jackett_image_version }}"
restart: always
env_file:
- {{ arrs_setup_path }}/env.jackett.conf
volumes:
- {{ jackett_config_volume }}:/config
- {{ torrent_downloads_volume }}:/downloads
{% for item in lidarr_music_volumes %}
- {{ item.path }}:/music/{{ item.alias }}
{% endfor %}
ports:
- {{ jackett_host_port }}:9117
networks:
- arrs
{% endif %}
networks:
arrs: {}

View File

@ -0,0 +1,8 @@
TZ={{ timezone }}
DELUGE_LOGLEVEL={{ deluge_loglevel }}
{% if arrs_uid %}
PUID={{ arrs_uid }}
{% endif %}
{% if arrs_gid %}
PUID={{ arrs_gid }}
{% endif %}

View File

@ -0,0 +1,8 @@
AUTO_UPDATE={{ jackett_auto_update }}
TZ={{ timezone }}
{% if arrs_uid %}
PUID={{ arrs_uid }}
{% endif %}
{% if arrs_gid %}
PUID={{ arrs_gid }}
{% endif %}

View File

@ -0,0 +1,7 @@
TZ={{ timezone }}
{% if arrs_uid %}
PUID={{ arrs_uid }}
{% endif %}
{% if arrs_gid %}
PUID={{ arrs_gid }}
{% endif %}

View File

@ -0,0 +1,8 @@
MONO_EXTERNAL_ENCODINGS=UTF-8
TZ={{ timezone }}
{% if arrs_uid %}
PUID={{ arrs_uid }}
{% endif %}
{% if arrs_gid %}
PUID={{ arrs_gid }}
{% endif %}