Merge branch 'samba-timemachine' of git://github.com/ryanolf/ansible-nas into ryanolf-samba-timemachine

* 'samba-timemachine' of git://github.com/ryanolf/ansible-nas:
  Fixed typo in time machine doc and added more detail
  Updated time machine documentation
  Changed timemachine data directory to be consistent with old AFP-based timemachine task
  Reverted unrelated change to tasks/users.yml
  Changed timemachine to use samba instead of netatalk, consistent with current standard
  Changed ansible-nas user to nologin shell
This commit is contained in:
David Stephens 2019-10-20 22:13:58 +01:00
commit c3a27b0122
7 changed files with 68 additions and 24 deletions

View file

@ -67,7 +67,7 @@ Ansible config and a bunch of Docker containers.
* [Tautulli](http://tautulli.com/) - Monitor Your Plex Media Server * [Tautulli](http://tautulli.com/) - Monitor Your Plex Media Server
* [Telegraf](https://github.com/influxdata/telegraf) - Metrics collection agent * [Telegraf](https://github.com/influxdata/telegraf) - Metrics collection agent
* [The Lounge](https://thelounge.chat) - Web based always-on IRC client * [The Lounge](https://thelounge.chat) - Web based always-on IRC client
* [TimeMachine](https://github.com/mbentley/docker-timemachine) - Mac backup server * [TimeMachine](https://github.com/awlx/samba-timemachine) - Samba-based mac backup server (see [upgrade note](https://davidstephens.uk/ansible-nas/upgrading/))
* [Traefik](https://traefik.io/) - Web proxy and SSL certificate manager * [Traefik](https://traefik.io/) - Web proxy and SSL certificate manager
* [Transmission](https://transmissionbt.com/) - BitTorrent client (with OpenVPN if you have a supported VPN provider) * [Transmission](https://transmissionbt.com/) - BitTorrent client (with OpenVPN if you have a supported VPN provider)
* [Wallabag](https://wallabag.org/) - Save and classify articles. Read them later. * [Wallabag](https://wallabag.org/) - Save and classify articles. Read them later.

View file

@ -1,14 +1,20 @@
# Time Machine # Time Machine
Apple docs: [https://support.apple.com/en-us/HT201250](https://support.apple.com/en-us/HT201250) Apple docs: [https://support.apple.com/en-us/HT201250](https://support.apple.com/en-us/HT201250)
Docker image: [https://github.com/mbentley/docker-timemachine](https://github.com/mbentley/docker-timemachine) Docker image: [https://github.com/awlx/samba-timemachine](https://github.com/awlx/samba-timemachine)
Time Machine is an application that allows you to backup files from your Mac. Time Machine is an application that allows you to backup files from your Mac.
Older versions of Time Machine relied on AFP (netatalk) shares. Apple has deprecated Time Machine over AFP in favor of SMB (Samba), and current versions of Ansible-NAS use a Samba-based Time Machine share. If you are upgrading from an older version of Ansible-NAS, you will need to re-select your Time Machine back up disk by opening Time Machine Preferences and Selecting your backup disk via the "Select Disk..." option. Your Mac will find the old backups on the share and use them.
## Usage ## Usage
Set `timemachine_enabled: true` in your `group_vars/all.yml` file. Set `timemachine_enabled: true` in your `group_vars/all.yml` file.
Enabling Time Machine will result in the installation of Avahi on the NAS system (if it is not already installed) and a Time Machine service configuration file for Avahi will be added to the system (at `/etc/avahi/services/timemachine.service`) to allow for Time Machine discovery by Macs on the local network. Avahi runs on the system, rather than in a container, as the same Avahi instance can be used to announce any number of services.
The Samba server included in the Time Machine docker container logs to `STDOUT` and is compatible with [Docker's built-in logging infrastructure.](https://docs.docker.com/config/containers/logging/)
## Specific Configuration ## Specific Configuration
<dl> <dl>
@ -17,8 +23,7 @@ Set `timemachine_enabled: true` in your `group_vars/all.yml` file.
<dt><strong>timemachine_volume_size_limit</strong></dt> <dt><strong>timemachine_volume_size_limit</strong></dt>
<dd>The maximum amount of space Time Machine can use for the backups in units of MiB. Set it to 0 for no limit.</dd> <dd>The maximum amount of space Time Machine can use for the backups in units of MiB. Set it to 0 for no limit.</dd>
<dt><strong>timemachine_share_name</strong></dt> <dt><strong>timemachine_share_name</strong></dt>
<dd>The name of the share as it will appear in the Time Machine application. Default is 'TimeMachine'</dd> <dd>The name of the share as it will appear in the Time Machine application. Default is 'Data'</dd>
<dt><strong>timemachine_password</strong></dt> <dt><strong>timemachine_password</strong></dt>
<dd>The password used to access the share. Default is 'timemachine'</dd> <dd>The password used to access the share. Default is 'timemachine'</dd>
<dt><strong>timemachine_log_level</strong></dt> <dl>
<dd>The verbosity of the logs. 'Error' is the default.</dd>

View file

@ -43,6 +43,7 @@ By default, applications can be found on the ports listed below.
| Sonarr | 8989 | | | Sonarr | 8989 | |
| Tautulli | 8181 | | | Tautulli | 8181 | |
| The Lounge | 9000 | | | The Lounge | 9000 | |
| Time Machine | 10445 | SMB |
| Traefik | 8083 | | | Traefik | 8083 | |
| Transmission | 9091 | with VPN | | Transmission | 9091 | with VPN |
| Transmission | 9092 | | | Transmission | 9092 | |

View file

@ -1,3 +1,5 @@
# Upgrading # Upgrading
Pull the latest Ansible-NAS repo, merge any new config sections from `group_vars/all.yml.dist` into your `group_vars/all.yml`, then run the playbook. Pull the latest Ansible-NAS repo, merge any new config sections from `group_vars/all.yml.dist` into your `group_vars/all.yml`, then run the playbook.
Older versions of Time Machine included in Ansible-NAS relied on AFP (netatalk) shares. Apple has deprecated Time Machine over AFP in favor of SMB (Samba), and current versions of Ansible-NAS use a Samba-based Time Machine share. If you are upgrading from an older version of Ansible-NAS with the AFP-based Time Machine, you will need to re-select your Time Machine back up disk by opening Time Machine Preferences and Selecting your backup disk via the "Select Disk..." option. Your Mac will find the old backups on the share and use them.

View file

@ -286,6 +286,8 @@ ansible_python_interpreter: /usr/bin/python3
### ###
# Seems to break browsing of the \\server-name shares root when enabled # Seems to break browsing of the \\server-name shares root when enabled
samba_mitigate_cve_2017_7494: false samba_mitigate_cve_2017_7494: false
# Enable apple exentensions for compatibility with apple clients
samba_apple_extensions: yes
# The account used when Samba shares are accessed. Shouldn't need to change this unless you want to # The account used when Samba shares are accessed. Shouldn't need to change this unless you want to
# mess with Samba user permissions. # mess with Samba user permissions.
@ -544,8 +546,9 @@ watchtower_command: "--schedule '{{ watchtower_cron_schedule }}' --debug"
timemachine_data_directory: "{{ docker_home }}/timemachine" timemachine_data_directory: "{{ docker_home }}/timemachine"
timemachine_volume_size_limit: 0 timemachine_volume_size_limit: 0
timemachine_password: timemachine timemachine_password: timemachine
timemachine_share_name: TimeMachine timemachine_share_name: Data
timemachine_log_level: error timemachine_log_level: error
timemachine_port: 10445
### ###
### minidlna ### minidlna

View file

@ -7,19 +7,33 @@
- name: Time Machine Docker Container - name: Time Machine Docker Container
docker_container: docker_container:
name: timemachine name: timemachine
image: mbentley/timemachine:latest image: awlnx/samba-timemachine:latest
pull: true pull: true
ports: ports:
- "548:548" - "{{ timemachine_port }}:445"
env: env:
VOLUME_SIZE_LIMIT: "{{ timemachine_volume_size_limit }}" TMSIZE: "{{ timemachine_volume_size_limit }}"
PASSWORD: "{{ timemachine_password }}" PASS: "{{ timemachine_password }}"
SHARE_NAME: "{{ timemachine_share_name }}" SHARENAME: "{{ timemachine_share_name }}"
LOG_LEVEL: "{{ timemachine_log_level }}"
volumes: volumes:
- "{{ timemachine_data_directory }}/data:/opt/timemachine" - "{{ timemachine_data_directory }}/data:/backups"
- "{{ timemachine_data_directory }}/logs:/var/log/supervisor" network_mode: bridge
- "/var/run/dbus:/var/run/dbus"
network_mode: host
restart_policy: unless-stopped restart_policy: unless-stopped
memory: 1g memory: 1g
- name: Install avahi
apt:
name: "avahi-daemon"
state: present
register: result
until: result is succeeded
- name: Setup timemachine service for avahi
template:
src: timemachine/timemachine.service
dest: "/etc/avahi/services/timemachine.service"
- name: Reload avahi configuration
service:
name: avahi-daemon
state: reloaded

View file

@ -0,0 +1,19 @@
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">Time Capsule on %h</name>
<service>
<type>_adisk._tcp</type>
<txt-record>sys=waMa=0,adVF=0x100</txt-record>
<txt-record>dk0=adVN=Data,adVF=0x82</txt-record>
</service>
<service>
<type>_smb._tcp</type>
<port>{{ timemachine_port }}</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=TimeCapsule6</txt-record>
</service>
</service-group>