After trying FreeNAS and OpenMediaVault I decided to create my own NAS solution. Here's why:
- I didn't like the idea of managing my server with BSD (FreeNAS) because I am more familiar with Debian based systems.
- OpenMediaVault seemed like a good alternative to FreeNAS, but after trying it I couldn't successfully find/install some of the plugins. I started few Docker containers to get my desired functionality alongside OMV and it seemed a little messy to switch between Docker based and Web based plugin management. In the end I decided to run all the plugins myself via Docker and be in full control of the whole system without depending on OMV releases.
- I found
davestephens
\ansible-nas
repo which seemed like a perfect start for my NAS server. - I like building things with Ansible!
- Creates RAIDs from two or more HDDs attached to your NAS
- Creates partitions from single HDDs attached to your NAS (in my case for Time Machine)
- Creates Samba shares for you to store your stuff
- Creates\Removes Docker containers:
- Plex Media Server for Media streaming and management
- Sonarr for downloading and managing TV shows
- Radarr for downloading and managing movies
- Jackett for translating Sonarr and Radarr queries to tracker-site-specific HTTP queries
- Transmission BitTorrent client (with OpenVPN if you have a supported VPN provider)
- Duplicati for backing up stuff
- Time Machine for backing up macOS to NAS server
- Glances for seeing the state of the system using a web browser
- Portainer for managing Docker and running custom images
- Nginx for proxy passing domain names to Docker containers on NAS server
I decided to include tasks for creating disk partitions mostly for testing purposes using Vagrant. However, since I applied this config for new system with new HDDs, I didn't really care about data integrity on my hard drives.
❗ I only recommend using mdadm
and parted
roles for Vagrant or entirely new systems, because getting partitioning wrong can be incredibly destructive.
Ansible NAS should work on any recent Debian box. Development was done on Debian Stretch.
git clone https://www.github.com/ernestasen/ansible-nas && cd ansible-nas
- Copy
roles/nas/defaults/main.yml
togroup_vars/nas.yml
- Edit
group_vars/nas.yml
and update variables based on your needs - Edit
hosts
file and update it with your NAS box hostname, IP and remote user - Run the playbook:
ansible-playbook -i hosts nas.yml --ask-become-pass
- Install Vagrant and VirtualBox
git clone https://www.github.com/ernestasen/ansible-nas && cd ansible-nas
- Copy
roles/nas/defaults/main.yml
togroup_vars/nas-vagrant.yml
- Edit
group_vars/nas-vagrant.yml
and update variables based on your needs - Start and provision Vagrant box:
cd vagrant/nas && vagrant up
- Run Ansible playbook against Vagrant box:
vagrant provision
I used host_vars/hostname.yml
for my secret variables like openvpn_username
and openvpn_password
to be automatically included to the playbook. You can also do the same or just create vault.yml
and include it in nas.yml
playbook manually. More information on Ansible Vault usage here.
Running playbook with Ansible Vault:
ansible-playbook -i hosts nas.yml --vault-id ~/.ansible_id --ask-become-pass