How to Install Ansible-NAS on Debian Latest
This tutorial will guide you through the process of installing Ansible-NAS on Debian Latest. Ansible-NAS is a set of Ansible playbooks that can be used to quickly set up a network-attached storage (NAS) server.
Prerequisites
Before starting the installation, ensure that you have the following prerequisites:
- A Debian Latest instance
- Root access to the server
- Basic knowledge of Linux terminal commands
Step 1: Install Git
To begin, you must install Git which is needed to clone the Ansible-NAS repository.
To install Git, run the following command in the terminal:
sudo apt update
sudo apt install git -y
Step 2: Clone the Ansible-NAS Repository
Next, you need to clone the Ansible-NAS repository from GitHub to your Debian Latest instance.
Run the following command in the terminal to clone the repository:
git clone https://github.com/DaveStephens/ansible-nas.git
Step 3: Install Ansible
Ansible-NAS is built on top of Ansible, thus you must install Ansible before proceeding with the installation.
Run the following command in the terminal to install Ansible:
sudo apt update
sudo apt install ansible -y
Step 4: Install Required Python Libraries
Ansible-NAS requires additional Python libraries to function properly.
Run the following command in the terminal to install the required Python libraries:
sudo apt update
sudo apt install python3-pip -y
sudo pip3 install netaddr
sudo pip3 install pyOpenSSL
sudo pip3 install passlib
sudo pip3 install bcrypt
Step 5: Configure the Ansible-NAS Variables
Once you have installed all the prerequisites, you need to configure the Ansible-NAS variables before running the playbook.
Navigate to the cloned Ansible-NAS repository directory using the following command:
cd ansible-nas/
Next, open the group_vars/all.yaml file and modify the following variables as per your requirements:
- nas_hostname: Set the hostname of your NAS server.
- ansible_user: Set the username under which you want to execute the playbook.
- nas_admin_users: Set the list of admin users with respective passwords who have access to the NAS server.
- nas_disk_partitions: Specify the disk partitions in the format
/dev/sda1, ext4wheresda1is the partition name andext4is the filesystem, separated by commas. - admin_email: Set the email address to which the NAS status reports are sent.
Save and close the file when you are done.
Step 6: Run the Ansible-NAS Playbook
You are now ready to run the Ansible-NAS playbook.
Run the following command in the terminal to execute the playbook:
ansible-playbook site.yml
The playbook sets up various services such as Samba, SSH, and more on your NAS server.
Step 7: Access the NAS Server
Once the playbook execution is complete, you can access the NAS server using the hostname/IP address that you specified in the nas_hostname variable.
You can also access the web GUI by visiting https://{{ nas_hostname }} in your web browser.
Conclusion
You have successfully installed Ansible-NAS on your Debian Latest instance. You can now use your NAS server for storage, file sharing, and more.