agaffney.synology_dsm
ansible-synology-dsm
Ansible role to set up a Synology NAS with DSM
Overview
ansible-synology-dsm is an Ansible role designed to configure a Synology NAS that runs DSM. It uses the Synology API to manage different services and settings.
Requirements
- Ansible version 2.6 or higher
- Access to a Synology NAS running DSM
Installation
Installing Directly from GitHub Repository
Create a Requirements File: Make a
requirements.ymlfile in your Ansible project folder with this content:- src: https://github.com/agaffney/ansible-synology-dsm name: ansible-synology-dsmInstall the Role Using
ansible-galaxy: Install the role directly from GitHub by running:ansible-galaxy install -r requirements.ymlReference the Role in Your Playbook: After installing, use the role in your playbook like this:
- hosts: synology_nas roles: - ansible-synology-dsmChange
synology_nasto match the correct host or group in your Ansible inventory.
This way, you can easily add the role to your Ansible workflows without needing it on Ansible Galaxy.
Usage
Login
Starts a session with the NAS for further API requests.
- include_tasks: login.yml
Enable/Disable File Services (NFS, SMB, AFP)
- name: Configure File Services
hosts: synology_nas
roles:
- ansible-synology-dsm
vars:
synology_dsm_nfs_enable: true # Enable NFS
synology_dsm_smb_enable: true # Enable SMB
synology_dsm_afp_enable: false # Disable AFP
Enable/Disable SSH/Telnet Services
- name: Configure Terminal Services
hosts: synology_nas
roles:
- ansible-synology-dsm
vars:
synology_dsm_ssh_enable: true # Enable SSH
synology_dsm_ssh_port: 22 # Set SSH port
synology_dsm_telnet_enable: false # Disable Telnet
Manage User Services
- name: Configure User Services
hosts: synology_nas
roles:
- ansible-synology-dsm
vars:
synology_dsm_user_home_service_enable: true # Enable User Home Service
synology_dsm_user_home_location: "/volume1/homes" # Set home directory location
synology_dsm_user_home_enable_recycle_bin: false # Disable recycle bin for user homes
Adding Package Sources
- name: Add Package Sources
hosts: synology_nas
roles:
- ansible-synology-dsm
vars:
synology_dsm_package_sources:
- name: "Example Source"
feed: "http://example.com/package/source"
Contributing
We welcome contributions. Please send pull requests for any improvements.
ansible-galaxy install agaffney.synology_dsm