Merge branch 'ryanolf-samba-timemachine'

* ryanolf-samba-timemachine:
  Rejig Time Machine docs
  Quote variables
  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:54:15 +01:00
commit 98bc464f31
6 changed files with 70 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
* [Telegraf](https://github.com/influxdata/telegraf) - Metrics collection agent
* [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
* [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)
* [Wallabag](https://wallabag.org/) - Save and classify articles. Read them later.

View file

@ -1,14 +1,20 @@
# Time Machine
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.
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
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
<dl>
@ -17,8 +23,11 @@ Set `timemachine_enabled: true` in your `group_vars/all.yml` file.
<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>
<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>
<dd>The password used to access the share. Default is 'timemachine'</dd>
<dt><strong>timemachine_log_level</strong></dt>
<dd>The verbosity of the logs. 'Error' is the default.</dd>
<dl>
## Upgrading from AFP to SMB-based Time Machine
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

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

View file

@ -286,6 +286,8 @@ ansible_python_interpreter: /usr/bin/python3
###
# Seems to break browsing of the \\server-name shares root when enabled
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
# mess with Samba user permissions.
@ -542,10 +544,11 @@ watchtower_command: "--schedule '{{ watchtower_cron_schedule }}' --debug"
### Time Machine
###
timemachine_data_directory: "{{ docker_home }}/timemachine"
timemachine_volume_size_limit: 0
timemachine_volume_size_limit: "0"
timemachine_password: timemachine
timemachine_share_name: TimeMachine
timemachine_share_name: Data
timemachine_log_level: error
timemachine_port: "10445"
###
### minidlna

View file

@ -6,20 +6,34 @@
- name: Time Machine Docker Container
docker_container:
name: timemachine
image: mbentley/timemachine:latest
pull: true
ports:
- "548:548"
env:
VOLUME_SIZE_LIMIT: "{{ timemachine_volume_size_limit }}"
PASSWORD: "{{ timemachine_password }}"
SHARE_NAME: "{{ timemachine_share_name }}"
LOG_LEVEL: "{{ timemachine_log_level }}"
volumes:
- "{{ timemachine_data_directory }}/data:/opt/timemachine"
- "{{ timemachine_data_directory }}/logs:/var/log/supervisor"
- "/var/run/dbus:/var/run/dbus"
network_mode: host
restart_policy: unless-stopped
memory: 1g
name: timemachine
image: awlnx/samba-timemachine:latest
pull: true
ports:
- "{{ timemachine_port }}:445"
env:
TMSIZE: "{{ timemachine_volume_size_limit }}"
PASS: "{{ timemachine_password }}"
SHARENAME: "{{ timemachine_share_name }}"
volumes:
- "{{ timemachine_data_directory }}/data:/backups"
network_mode: bridge
restart_policy: unless-stopped
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>