Setting up Plex, Samba, Transmission on Raspberry pi 4 using Ansible

Foreword

I recently started using Plex media server to watch videos on TV via Amazon fire stick. The Plex server was configured on the desktop, and the video files were connected via an external USB drive, and such a bundle, in principle, suited me. However, when the PC is turned off, there is no access to the content and every time you turn on the PC just to watch a movie or listen to music it has already begun to strain. Therefore, I decided to set up plex on a raspberry and connect an external USB with the existing content to it. And already in the process, I realized that it would still be nice to have access to files and a rocking chair for torrents and at the same time simplify the setup process using automation on Ansible. Playbook uploaded to GitHub .





What is required (hardware / software)

  • Window and Ubuntu Desktop. In principle, you can only do one thing, but I'm more used to doing some things on Windows, and some on Ubuntu. (Ubuntu is installed via VirtualBox on Windows). All the same, I think, will succeed without problems on the Mac.





  • Raspberry Pi Imager for Windows. Can be downloaded from the official website .





  • Raspberry Pi OS Lite image. Also from the official site. It is faster to download via torrent than via direct link.





  • Raspberry pi 3/4. Initially, I experimented on the third version, but then I bought the fourth.





  • SD card 8Gb or more. (USB card reader)





  • Ansible for Ubuntu description and installation here .





  • USB disk. Preferably from USB 3.0 if you are building on pi 4.





  • 3A power supply to provide enough power for the connected USB disk.





  • Playbook for Ansible from GitHub .





  • Git.





raspberry pi

SD- Pi Imager. Choose image Use custom , . , , , , . SD- write.





USB NTFS ( usb_750g), raspberry. USB NTFS, . exFAT, raspberry , NTFS. , .





Windows Ubuntu.





SD- Ubuntu VirtualBox. boot



rootfs



. boot cd /media/_/boot/



. ssh- echo "" > /media/$LOGIN/boot/ssh



( berez ), raspberry, ssh-.





raspberry ssh , Ansible. cd ~/.ssh && ssh-gen



( , ). raspberry, enter. : raspberry raspberry.pub, . , raspberry. rootfs mkdir -p /media/$LOGIN/rootfs/home/pi/.ssh



cp ~/.ssh/raspberry.pub /media/$LOGIN/rootfs/home/pi/.ssh/authorized_keys



.





SD- raspberry, , USB . IP , , IP MAC-. IP raspberry MAC-. MAC- raspberry. cat /sys/class/net/eth0/address



.





Ubuntu Ansible, . git clone https://github.com/notfoundsam/raspberry-plex-ansible.git



cd raspberry-plex-ansible



.





IP raspberry hosts.ini



, Ansible . , .





group_vars/all.yml



, raspberry, ansible_user



. ssh ansible_ssh_private_key_file



. , . host_name



. usb_volume_label



USB . . transmission , transmission_username



, transmission_password



, transmission_white_list



. transmission_white_list



127.0.0.1.





Plex . plex.yml



ansible-playbook plex.yml



, Plex . ansible-playbook usb-volume.yml



, USB . raspberry_ip:32400/web



, plex . , plex , raspberry_ip:32400/web



. , , plex - . plex USB .





samba-. raspberry , , Samba USB . ansible-playbook samba.yml



. , Windows , workgroup, /etc/samba/smb.conf



raspberry. IP \\raspberry_ip



Windows.





Transmission. , transmission iptables, downloads USB . , transmission .part . 51413 . raspberry_ip:9091/transmission



, group_vars/all.yml



. Network , 51413 . closed, .





raspberry 3 raspberry 4

raspberry pi 3B / 3B+/ 4B. pi 3 100Mbs, 100-200GB . 3B+ , 1Gbs. Plex , H.264, avi MPEG4(XVID) , - , , . TV , .





pi 3B+ , . , , pi 4B. pi 4B MPEG4, 10-15 . USB 3.0 .





Samsung Evo+ SanDisk Ultra. .





/

  • Raspberry pi 4B 4GB RAM ~ $62





  • SD- Samsung Evo+ ~ $8





  • ~ $17 (Amazon.co.jp) "Geekworm Raspberry Pi 4B (P173 Black) Passive Cooling Metal Case"





  • USB 3.0 750GB ( 4 ) ~ $50





  • Anker PowerPort 6 ( 3 ) ~ $30





, . $87.





-, . . - USB + Samba + Transmission raspberry pi 3B, 100Mbs , pi 3B+. Ansible .

, , Samba , .





I hope that this material will help you to quickly cope with a similar task. If you have suggestions for improvement, criticism or errors, write in the comments.





Future plans

The volume of data is constantly growing, so I plan to buy an additional rack with a USB hub and several bays for HDD drives. Plans to purchase one of these: Yottamaster Hard Drive with 4 bays. There is already a built-in RAID controller, but I will probably take it without it. If RAID is required, then I will configure it on raspberry and leave the rest as single for only two disks. And I'll switch the old 750GB disk to downloading torrents.








All Articles