Manage a TerraMaster NAS device with Ansible over SSH.
This has only been tested against a TerraMaster F5-422. You risk damaging your device and data here, so please do not attempt anything without careful consideration.
-
Install Ansible
-
Clone this repository
-
Connect over SSH and edit the
/etc/ssh/sshd_config
to update theAllowUsers
to include your unique userAllowUsers admin myuser
-
Add a public key to
~/.ssh/authorized_keys
(disable SSH password authentication in/etc/ssh/sshd_config
if you like) -
Change the permissions on
/dev/null
to666
to prevent an Ansible failure$ sudo chmod 666 /dev/null $ ls -l /dev/null crw-rw-rw- 1 root root 1, 3 Oct 10 20:19 /dev/null
- Rename the
inventory.example
file toinventory.ini
- Update the values of
ansible_host
,ansible_port
,ansible_ssh_private_key_file
, andansible_user
withininventory.ini
as appropriate - Run the
example-playbook.yml
playbook to confirm that Ansible is connecting without error to your TNAS (TerraMaster NAS).
The -K
flag will prompt for the root user's password
$ ansible-playbook -i ./inventory.ini -K ./example-playbook.yml
BECOME password:
PLAY [TerraMaster] ************************************************************************************************************
TASK [Gathering Facts] ********************************************************************************************************
ok: [F5-422]
TASK [ping] *******************************************************************************************************************
ok: [F5-422]
PLAY RECAP ********************************************************************************************************************
F5-422 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
As the TerraMaster does not use a standard Linux distribution, there are many Ansible modules that will likely not work as you expect.