Install Media Managers with Ansible
2 min read

Install Media Managers with Ansible

I've created a role for all your media management needs. Check it out!
Install Media Managers with Ansible

When I started automating my infrastructure with Ansible, I created a role for each piece of software I had, Sonarr among them. I've added then Navidrome (and Bonob) for my music library, Lidarr... Then, I saw that all *arr instances have the same configuration, you can add a torrent and add more indexes via Jackett. So, I've decided to create a convenient role which brings them all together.

The laurivan.arrs role will install the following:

  • Deluge - to manage torrents,
  • Jackett - the add more indexers,
  • Sonarr - to manage series,
  • Lidarr - to manage music and
  • Radarr - to manage movies.

Use the role

Note: I urge you to read the role description for the most up-to-date variant.

I wrote the role for flexibility. The variables in the current version (1.0.10 at the time of writing) have a common section and sections dedicated to each component.

Common variables

This section defines variables common to all components:

timezone: 'Europe/Brussels'
torrent_downloads_volume: '/mnt/download'
arrs_configuration_volume: '/mnt/config'
arrs_setup_path: '~/arrs'
arrs_uid:
arrs_gid:

The ..._volume variables define paths to be used in docker. arrs_setup_path defines the location of the docker-config.yml and container environment files.

arrs_uid and arrs_gid allow you to define a user for the docker containers. It's useful if you have nfs-mounted volumes which can be accessed by specific users.

You can enable/disable services to be installed:

deluge_enabled: true 
radarr_enabled: true 
sonarr_enabled: true 
lidarr_enabled: true 
jackett_enabled: true

All services are installed by default. Internally, this will customize the docker-compose.yml file.

Specific variables

Each media manager has the same layout:

manager_image_version: 'latest'
manager_host_port: manager_port

manager_config_volume: '{{ arrs_configuration_volume }}/[manager]'
manager_upload_volume: '/mnt/videos/Movies'
manager_library_volumes: 
  - {path: '/mnt/video/EN', alias: 'EN' }
  - {path: '/mnt/video/DE', alias: 'DE' }
  - {path: '/mnt/video/FR', alias: 'FR' }

The manager is sonarr, lidarr or radarr.

If you have an already existing library and you dont want it polluted by the automated downloads (e.g. the library is not flat), then you can use manager_library_volumes to add it separately and all paths will be mounted in /library. All items have two components:

  • the path - the local path (e.g. /mnt/video/EN) and
  • the alias - the name under which the volume is mounted.

A string:

{ path: '/mnt/video/EN', alias: 'EN' }

is translated into the following volume entry:

- "/mnt/video/EN:/library/EN"

Note: I use quotes to allow for paths with spaces.

Deluge and Jackett

Deluge and Jackett don't need any specific volumes besides the configuration one. For Deluge, the download path is declared with torrent_downloads_volume.

Bonus

All configurations are in convenient placed for easy backup:

  1. arrs_configuration_volume - the docker-compose.yml and docker config files and
  2. arrs_configuration_volume - configurations for all docker containers.

I have the following setup for ansible-role-borg-backup:

borg_repository: "/mnt/backup/services"
borg_source_directories:
  # Arrs
  - /home/laur/arrs
  - /mnt/arrs
borgmatic_hooks:
  before_backup:
    - echo "Stopping containers (backup)"
    - cd /home/laur/arrs && docker-compose stop
    - echo "------ Done"
  after_backup:
    - echo "Starting containers (backup)"
    - cd /home/laur/arrs && docker-compose start
    - echo "------ Done"
  before_extract:
    - echo "Stopping containers (extract)"
    - cd /home/laur/arrs && docker-compose stop
    - echo "------ Done"
  after_extract:
    - echo "Starting containers (extract)"
    - cd /home/laur/arrs && docker-compose start
    - echo "------ Done"

This ensures also the services are cleanly shut down and restarted to avoid any inconsistencies.

HTH,