Split arr role from playbook

This commit is contained in:
Marty Oehme 2025-04-12 09:39:39 +02:00
parent eaaa35de25
commit 71244751c7
Signed by: Marty
GPG key ID: 4E535BC19C61886E
11 changed files with 356 additions and 11 deletions

View file

@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View file

@ -0,0 +1,9 @@
---
arrstack_env_dir: /opt/arrstack
arrstack_data_dir: /srv
arrstack_data_dir_create: true
arrstack_data_dir_owner: 1000
arrstack_data_dir_group: 1000

View file

@ -0,0 +1,2 @@
---
# handlers file for arr

View file

@ -0,0 +1,26 @@
galaxy_info:
author: Marty Oehme
description: Deploying a full *arr stack
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
license: GPL-3.0-only
min_ansible_version: "2.1"
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View file

@ -1,11 +0,0 @@
---
- name: Deploy wallabag to swarm
community.general.docker_stack:
name: arr
state: present
prune: true
compose:
- "{{ lookup('template', 'docker-stack.yml.j2') | from_yaml }}"
become: true
tags:
- docker-swarm

View file

@ -0,0 +1,55 @@
---
- name: Create Arr stack environment directory
ansible.builtin.file:
state: directory
path: "{{ arrstack_env_dir }}"
owner: root
group: root
mode: 0700
- name: Create Arr stack data directory
ansible.builtin.file:
state: directory
path: "{{ arrstack_data_dir }}/{{ item }}"
owner: "{{ arrstack_data_dir_owner }}"
group: "{{ arrstack_data_dir_group }}"
mode: 0770
when: arrstack_data_dir_create
loop:
- ""
- files
- files/torrents
- files/usenet
- media
- media/tv
- media/movies
- media/music
- media/audiobooks
# - name: Create Docker Compose environment file
# ansible.builtin.template:
# src: docker-compose.yml.j2
# dest: "{{ arrstack_env_dir }}/docker-compose.yml"
# owner: root
# group: root
# mode: 0600
- name: Install pyyaml # necessary for compose_v2
ansible.builtin.package:
name: python3-yaml
state: present
- name: Start the compose stack
community.docker.docker_compose_v2:
project_name: arr
# project_src: "{{ arrstack_env_dir }}"
definition: "{{ lookup('template', 'docker-compose.yaml.j2') | from_yaml }}"
wait: true
wait_timeout: 60
# services:
# - transmission
# - flaresolverr
# - sonarr-hd
# - sonarr-4k
# - sonarr-anime
# - prowlarr

View file

@ -0,0 +1,209 @@
services:
whoami:
container_name: whoami
image: traefik/whoami
ports:
- 80:80
sonarr:
container_name: sonarr
image: lscr.io/linuxserver/sonarr:latest
ports:
- 8989:8989
env_file:
- arr.env
volumes:
- "./config/sonarr:/config"
- "{{ arrstack_data_dir }}/media/tv:/data/media/tv"
- "{{ arrstack_data_dir }}/files/usenet:/data/usenet"
- "{{ arrstack_data_dir }}/files/torrent:/data/torrent"
restart: unless-stopped
radarr:
container_name: radarr
image: lscr.io/linuxserver/radarr:latest
ports:
- 7878:7878
env_file:
- arr.env
volumes:
- "./config/radarr:/config"
- "/mnt/ext/data/media/movies:/data/media/movies" # FIXME: Find solution
- "{{ arrstack_data_dir }}/files/usenet:/data/usenet"
- "{{ arrstack_data_dir }}/files/torrent:/data/torrent"
restart: unless-stopped
lidarr:
container_name: lidarr
image: lscr.io/linuxserver/lidarr:latest
ports:
- 8686:8686
env_file:
- arr.env
- mb.env
environment:
- DOCKER_MODS=linuxserver/mods:universal-docker
volumes:
- "./config/lidarr:/config"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "{{ arrstack_data_dir }}/media/music:/data/media/music"
- "{{ arrstack_data_dir }}/files/usenet:/data/usenet"
- "{{ arrstack_data_dir }}/files/torrent:/data/torrent"
restart: unless-stopped
readarr:
container_name: readarr
image: lscr.io/linuxserver/readarr:develop
ports:
- 8787:8787
env_file:
- arr.env
volumes:
- "./config/readarr:/config"
- "{{ arrstack_data_dir }}/media/audiobooks:/data/media/audiobooks"
- "{{ arrstack_data_dir }}/files/usenet:/data/usenet"
- "{{ arrstack_data_dir }}/files/torrent:/data/torrent"
restart: unless-stopped
prowlarr:
container_name: prowlarr
image: lscr.io/linuxserver/prowlarr:develop
env_file:
- arr.env
volumes:
- "./config/prowlarr:/config"
ports:
- 9696:9696
restart: unless-stopped
sabnzbd:
container_name: sabnzbd
image: lscr.io/linuxserver/sabnzbd:latest
env_file:
- arr.env
volumes:
- "./config/sabnzbd:/config"
- "{{ arrstack_data_dir }}/files/usenet:/data/usenet:rw"
ports:
- 8080:8080
restart: unless-stopped
vpn:
image: qmcgaw/gluetun:v3
container_name: vpn
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
env_file:
- arr.env
- pia.env
environment:
- VPN_PORT_FORWARDING_STATUS_FILE=/gluetun/forwarded_port
- FIREWALL_OUTBOUND_SUBNETS=172.18.0.0/24
- BLOCK_SURVEILLANCE=on
volumes:
- "./config/gluetun:/gluetun"
ports:
- 8000:8000 # gluetun http control
- 8888:8888 # qBittorrent WebUI
restart: unless-stopped
qbittorrent:
image: linuxserver/qbittorrent
container_name: qbittorrent
env_file:
- arr.env
environment:
- WEBUI_PORT=8888
volumes:
- "./config/piaqbit:/config"
- "./config/gluetun:/gluetun"
- "{{ arrstack_data_dir }}/files/torrent:/downloads"
depends_on:
- vpn
network_mode: "service:vpn"
restart: unless-stopped
gluetun-qbittorrent-port-manager:
image: patrickaclark/gluetun-qbittorrent-port-manager:latest
container_name: qbit-port-manager
env_file:
- arr.env
- pia.env
environment:
- QBITTORRENT_SERVER=localhost # IP Address of qbittorrent
- QBITTORRENT_PORT=8888
- PORT_FORWARDED=/gluetun/forwarded_port
- HTTP_S=http # Select 'http' or 'https' depending on if you use certificates.
- GLUETUN_HOST=localhost # IP or FQDN of gluetun control server
- GLUETUN_PORT=8000 # port of gluetun control server
- RECHECK_TIME=60 # number of seconds between checks to gluetun server for port
volumes:
- "./config/gluetun:/gluetun"
depends_on:
- vpn
network_mode: "service:vpn"
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-H", "Authorization: $controlServerAuthKey", "-s", "http://localhost:8000/v1/openvpn/status", "|", "grep", "-q", '{"status":"running"}']
interval: 30s
timeout: 10s
start_period: 60s
retries: 3
jellyfin:
image: lscr.io/linuxserver/jellyfin:latest
container_name: jellyfin
env_file:
- arr.env
#environment:
#- JELLYFIN_PublishedServerUrl=192.168.0.5 #optional
volumes:
- ".config/jellyfin:/config"
- "/mnt/ext/data/media/movies:/media/movies" # FIXME: To be changed?
- "{{ arrstack_data_dir }}/media/tv:/media/tv"
- "{{ arrstack_data_dir }}/media/music:/media/music"
ports:
- 8096:8096
- 7359:7359/udp #optional - network discovery
- 1900:1900/udp #optional - dlna discovery
restart: unless-stopped
audiobookshelf:
container_name: audiobookshelf
image: ghcr.io/advplyr/audiobookshelf:latest
env_file:
- arr.env
ports:
- 13378:80
volumes:
- "{{ arrstack_data_dir }}/media/audiobooks:/audiobooks"
# - "{{ arrstack_data_dir }}/media/podcasts:/podcasts" # TODO: If integrating podcasts
- ".config/audiobookshelf:/config"
- ".metadata/audiobookshelf:/metadata"
restart: unless-stopped
jellyseerr:
image: fallenbagel/jellyseerr:latest
container_name: jellyseerr
env_file:
- arr.env
ports:
- 5055:5055
volumes:
- "./config/jellyseerr:/app/config"
restart: unless-stopped
beets:
image: lscr.io/linuxserver/beets:latest
container_name: beets
env_file:
- arr.env
- mb.env
volumes:
- "./config/beets:/config"
- "{{ arrstack_data_dir }}/media/music:/music"
- "{{ arrstack_data_dir }}/files/music-unsorted:/downloads"
ports:
- 8337:8337
restart: unless-stopped
homarr:
image: ghcr.io/ajnart/homarr:latest
container_name: homarr
volumes:
- /var/run/docker.sock:/var/run/docker.sock # Optional, only if you want docker integration
- ./config/homarr/configs:/app/data/configs
- ./config/homarr/icons:/app/public/icons
- ./config/homarr/data:/data
ports:
- '80:7575'
restart: unless-stopped

View file

@ -0,0 +1,2 @@
localhost

View file

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- arr

View file

@ -0,0 +1,2 @@
---
# vars file for arr