ahembree / ansible-hms-docker

Ansible playbook for automated home media server setup
GNU General Public License v3.0
391 stars 47 forks source link

ansible-hms-docker

Deployment Tests

Ansible Playbook to setup an automated Home Media Server stack running on Docker across a variety of platforms with support for GPUs, SSL, SSO, DDNS, and more.

Getting Started

Container List

Media Servers

Media Management Systems

Download Clients

Analytics / Dashboards

Networking

Misc

Other Features

Supported Platforms

Currently only Ubuntu 22.04+ is actively supported and is used for GitHub Actions testing.

RHEL based systems (CentOS 8, Fedora, Alma Linux, Rocky Linux) may work, but are no longer being tested against.

Requirements


WARNING

This playbook assumes that it is a fresh install of an operating system that has not been configured yet. It should be safe to run on an existing system, BUT it may cause issues with Python since it installs Python 3.8, Docker repos, configures Nvidia GPU acceleration (if enabled), and configures network mounts (if enabled).

To ensure no conflicting changes with an existing system, you can run this playbook in "check mode" to see if any changes would be made by running make check

Scope of the Project

Setting up the individual container configurations, such as for Sonarr, Radarr, Overseerr, Prowlarr, etc. are outside the scope of this project. The purpose of this project is to ensure the necessary base containers are running with the appropriate configs.


Installation

It is recommended to read and follow this guide entirely as there is a lot of configuration options that are required to get the system up and running to its full potential.

  1. Install requirements and clone the repository:

    Ubuntu:

    sudo apt update
    sudo apt install git make python3-pip -y
    sudo pip3 install ansible
    # Clone the repository and then go into the folder
    git clone https://github.com/ahembree/ansible-hms-docker.git
    cd ansible-hms-docker/
  2. Proceed to Configuration


Updating

To easily update from this git repo and update your custom variable names (due to deprecating/renaming variables), run:

make update

Previous variable names will still work for at least a year after the change and will be noted as such within the default configs. Please update to resolve.


Configuration

Copy the base configurations to the vars/custom directory by running:

make basic

You can also quickly copy the advanced configurations by running:

make advanced

NOTE: Re-running these commands will overwrite any existing files in the vars/custom directory

If you wish to add a user(s) to the docker group so they can run docker commands without using sudo, you can uncomment and modify the lines in vars/default/docker.yml, or just run (as a user with sudo/root access) sudo usermod -aG docker <username>

Content Layout

By default, the content is laid out in the following directory structure, if you wish to change the install location, you must use the advanced configuration

Generated compose file location: /opt/hms-docker/docker-compose.yml

Container data directory: /opt/hms-docker/apps

Default mount path for local share (known as the mount_path in this readme): /opt/hms-docker/media_data/

Media folder that contains movie and tv show folders (known as the media_path in this readme): <mount_path>/_library

Movie folder: <media_path>/Movies

TV Show folder: <media_path>/TV_Shows

Secrets file (where sensitive key material is stored, other than the ansible variable files in vars/custom): /opt/hms-docker/.env

General Configuration

All configuration options are in a (hopefully) aptly-named .yml file. Once you copied the config you want (by running make basic or make advanced), these config files are now in vars/custom

If you have your media content stored on a NAS that will be connected via NFS or CIFS, please follow the directions in the NAS readme (after updating your hms_docker_media_share_type to the correct value as outlined above)


Running the playbook

You can run the playbook using the included Makefile with the following commands:

# Check mode
make check

# Apply changes
make apply

Once the playbook has finished running, it may take up to a few minutes for the SSL certificate to be generated (if enabled).

Accessing the Containers

If you do not already have a "wildcard" DNS record (*) setup for the domain you used on your LOCAL DNS server (such as *.home.local), create this A record to point to the IP address of the server. If you enabled Cloudflare DDNS, an "overseerr" public A record will be created automatically.

You can also create individual A records for each container listed in the container map, or have 1 A record with multiple CNAME records pointed to the A record.

If the above DNS requirements are met, you can then access the containers by using the following URLs (substituting < domain > for the domain you used).

You can also change the subdomain of each application within the advanced hms_docker_container_map setting.

Plex: https://plex.< domain >

Sonarr: https://sonarr.< domain >

Radarr: https://radarr.< domain >

Bazarr: https://bazarr.< domain >

Overseerr: https://overseerr.< domain >

Requestrr: https://requestrr.< domain >

Prowlarr: https://prowlarr.< domain >

Transmission: https://transmission.< domain >

Tautulli: https://tautulli.< domain >

Traefik: https://traefik.< domain >

NZBGet: https://nzbget.< domain >

Authentik: https://authentik.< domain >

Tdarr: https://tdarr.< domain >

Homepage: https://homepage.< domain >

Uptime Kuma: https://uptime-kuma.< domain >