Previously I had a plex setup on a dedicated computer in my house, however, I recently purchased a Ugreen NAS, and wanted to migrate plex to the Ugreen machine since it supports docker. Here are the steps to get it working.
2.a Ensure your user is able to access docker, either manually, or via ansible:
- name: adding {{ username }} to group docker
tags: docker
become: true
ansible.builtin.user:
name: "{{ username }}"
groups: docker
append: true
You can test it's working by ssh-ing into the NAS and issuing docker ps - if you get no errors, you're good.
I have previously created an ansible role for installing plex here: https://github.com/compscidr/ansible-media-server, so I'll be using this going forward.
collections:
- name: compscidr.media_server
version: "<insert version here>"
ansible-galaxy install -r meta/requirements.yml- name: Services for nas.local
hosts: nas.local
roles:
- role: compscidr.media_server.plex
vars:
plex_dri_devices: true
plex_bonjour_port: 5354
plex_tv_folder: /volume1/storage/tv
plex_movies_folder: /volume1/storage/movies
plex_pid: "999"
plex_gid: "10"
** Note **, the GID and PID are what the UGOS containers seem to run with - if you don't do this part, plex will have trouble scanning the libraries due to permissions.
** Note2 **, on the first run you will also want to add plex_claim: with the token you get from https://www.plex.tv/claim/ in order to claim the server. After the server is setup, you can remove this.
deploy the ansible play
ansible-playbook -i inventory.yml playbook.yml --ask-become-pass --limit nas.local --tags plex
Optionally deploy the watchtower container to keep the plex container up to date:
- name: docker watchtower container
tags: docker, watchtower
become: true
community.docker.docker_container:
name: watchtower
image: containrrr/watchtower
pull: true
command: --http-api-update --http-api-periodic-polls --include-restarting --log-level debug
env:
WATCHTOWER_HTTP_API_TOKEN: mytoken
ports:
- "8081:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
restart_policy: unless-stopped
I've had a GitHub profile stats card for a while now, but I was never fully happy with it. The existing tools each had trade-offs that bugged me, so I ended up building my own by combining the best parts of three different projects. Here's how it went. The Problem There are a few popular projects fo...