From 846a6f8c358c3ffef0bb8e18364307801a483d9f Mon Sep 17 00:00:00 2001 From: Ryan Olf Date: Sun, 25 Aug 2019 15:24:29 -0700 Subject: [PATCH 01/16] Adding homebridge support --- group_vars/all.yml.dist | 9 +++++++++ nas.yml | 4 ++++ tasks/homebridge.yml | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 tasks/homebridge.yml diff --git a/group_vars/all.yml.dist b/group_vars/all.yml.dist index 08a5dc04..7e046286 100644 --- a/group_vars/all.yml.dist +++ b/group_vars/all.yml.dist @@ -319,6 +319,15 @@ plex_tv_permissions: "rw" plex_user_id: 0 plex_group_id: 0 +### +### Homebridge +### +homebridge_available_externally: "false" +homebridge_config_directory: "{{ docker_home }}/homebridge/config" +homebridge_user_id: 0 +homebridge_group_id: 0 +homebridge_ui_port: 8087 + ### ### Emby ### diff --git a/nas.yml b/nas.yml index c351ca5e..d6aec1ec 100644 --- a/nas.yml +++ b/nas.yml @@ -171,3 +171,7 @@ - import_tasks: tasks/mosquitto.yml when: (mosquitto_enabled | default(False)) tags: mosquitto + + - import_tasks: tasks/homebridge.yml + when: (homebridge_enabled | default(False)) + tags: homebridge diff --git a/tasks/homebridge.yml b/tasks/homebridge.yml new file mode 100644 index 00000000..781bad84 --- /dev/null +++ b/tasks/homebridge.yml @@ -0,0 +1,25 @@ +--- +- name: Create Homebridge Directories + file: + path: "{{ item }}" + state: directory + # mode: 0755 + with_items: + - "{{ homebridge_config_directory }}" + +- name: Homebridge Docker Container + docker_container: + name: homebridge + image: oznu/homebridge + pull: true + volumes: + - "{{ homebridge_config_directory }}:/homebridge" + network_mode: host + env: + TZ: "{{ ansible_nas_timezone }}" + PGID: "{{ homebridge_group_id }}" + PUID: "{{ homebridge_user_id }}" + HOMEBRIDGE_CONFIG_UI: 1 + HOMEBRIDGE_CONFIG_UI_PORT: "{{ homebridge_ui_port }} " + restart_policy: unless-stopped + memory: 1g From 2ee28bdbd1fb56053db83697fd88c07a0b0cbecb Mon Sep 17 00:00:00 2001 From: Ryan Olf Date: Wed, 28 Aug 2019 15:49:08 -0700 Subject: [PATCH 02/16] Removed available_externally and added homembridge_enabled to all.yml.dist --- group_vars/all.yml.dist | 4 +++- tasks/homebridge.yml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/group_vars/all.yml.dist b/group_vars/all.yml.dist index 7e046286..8a51ac10 100644 --- a/group_vars/all.yml.dist +++ b/group_vars/all.yml.dist @@ -77,6 +77,9 @@ wallabag_enabled: false # MQTT mosquitto_enabled: false +# Home automation +homebridge_enabled: false + ### ### General ### @@ -322,7 +325,6 @@ plex_group_id: 0 ### ### Homebridge ### -homebridge_available_externally: "false" homebridge_config_directory: "{{ docker_home }}/homebridge/config" homebridge_user_id: 0 homebridge_group_id: 0 diff --git a/tasks/homebridge.yml b/tasks/homebridge.yml index 781bad84..919cac4e 100644 --- a/tasks/homebridge.yml +++ b/tasks/homebridge.yml @@ -20,6 +20,6 @@ PGID: "{{ homebridge_group_id }}" PUID: "{{ homebridge_user_id }}" HOMEBRIDGE_CONFIG_UI: 1 - HOMEBRIDGE_CONFIG_UI_PORT: "{{ homebridge_ui_port }} " + HOMEBRIDGE_CONFIG_UI_PORT: "{{ homebridge_ui_port }}" restart_policy: unless-stopped memory: 1g From 3aa4fe4e48ab96b1eed8991cbb7637aebdadc22b Mon Sep 17 00:00:00 2001 From: Ryan Olf Date: Wed, 28 Aug 2019 23:07:35 -0700 Subject: [PATCH 03/16] Added variables and settings for traefik compatibility --- group_vars/all.yml.dist | 1 + tasks/homebridge.yml | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/group_vars/all.yml.dist b/group_vars/all.yml.dist index 8a51ac10..3f5ea7ed 100644 --- a/group_vars/all.yml.dist +++ b/group_vars/all.yml.dist @@ -325,6 +325,7 @@ plex_group_id: 0 ### ### Homebridge ### +homebridge_available_externally: "false" homebridge_config_directory: "{{ docker_home }}/homebridge/config" homebridge_user_id: 0 homebridge_group_id: 0 diff --git a/tasks/homebridge.yml b/tasks/homebridge.yml index 919cac4e..d86cf55a 100644 --- a/tasks/homebridge.yml +++ b/tasks/homebridge.yml @@ -17,9 +17,14 @@ network_mode: host env: TZ: "{{ ansible_nas_timezone }}" - PGID: "{{ homebridge_group_id }}" - PUID: "{{ homebridge_user_id }}" - HOMEBRIDGE_CONFIG_UI: 1 - HOMEBRIDGE_CONFIG_UI_PORT: "{{ homebridge_ui_port }}" + PGID: "{{ homebridge_group_id | string }}" + PUID: "{{ homebridge_user_id | string }}" + HOMEBRIDGE_CONFIG_UI: "1" + HOMEBRIDGE_CONFIG_UI_PORT: "{{ homebridge_ui_port | string }}" restart_policy: unless-stopped memory: 1g + labels: + traefik.backend: "homebridge" + traefik.frontend.rule: "Host:homebridge.{{ ansible_nas_domain }}" + traefik.enable: "{{ homebridge_available_externally | string }}" + traefik.port: "{{ homebridge_ui_port | string }}" From cae4fa57611f9528692ad6c64385eb73baccf53d Mon Sep 17 00:00:00 2001 From: David Stephens Date: Tue, 26 Nov 2019 00:04:05 +0000 Subject: [PATCH 04/16] Add Homebridge docs --- docs/applications/homebridge.md | 11 +++++++++++ docs/configuration/application_ports.md | 1 + 2 files changed, 12 insertions(+) create mode 100644 docs/applications/homebridge.md diff --git a/docs/applications/homebridge.md b/docs/applications/homebridge.md new file mode 100644 index 00000000..d91e6b98 --- /dev/null +++ b/docs/applications/homebridge.md @@ -0,0 +1,11 @@ +# Homebridge + +Homepage: [https://github.com/nfarina/homebridge](https://github.com/nfarina/homebridge) + +Homebridge is a lightweight NodeJS server you can run on your home network that emulates the iOS HomeKit API. It supports Plugins, which are community-contributed modules that provide a basic bridge from HomeKit to various 3rd-party APIs provided by manufacturers of "smart home" devices. + +## Usage + +Set `homebridge_enabled: true` in your `group_vars/all.yml` file. + +The Homebridge web interface can be found at http://ansible_nas_host_or_ip:8087. diff --git a/docs/configuration/application_ports.md b/docs/configuration/application_ports.md index 8412aedb..f961eac4 100644 --- a/docs/configuration/application_ports.md +++ b/docs/configuration/application_ports.md @@ -23,6 +23,7 @@ By default, applications can be found on the ports listed below. | Guacamole | 8090 | | | Heimdall | 10080 | | | Home Assistant | 8123 | | +| Homebridge | 8087 | | | Jackett | 9117 | | | Jellyfin | 8896 | HTTP | | Jellyfin | 8928 | HTTPS | From 1855b36c1051e2fa43587104406ea6c8f8f57853 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Tue, 26 Nov 2019 00:19:20 +0000 Subject: [PATCH 05/16] Add default username and password to homebridge docs --- docs/applications/homebridge.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/applications/homebridge.md b/docs/applications/homebridge.md index d91e6b98..645df83d 100644 --- a/docs/applications/homebridge.md +++ b/docs/applications/homebridge.md @@ -8,4 +8,4 @@ Homebridge is a lightweight NodeJS server you can run on your home network that Set `homebridge_enabled: true` in your `group_vars/all.yml` file. -The Homebridge web interface can be found at http://ansible_nas_host_or_ip:8087. +The Homebridge web interface can be found at http://ansible_nas_host_or_ip:8087. The default username and password is 'admin' - change this after your first login! From 7cccd3fce7883980bfb89d59971b6f528dba5a19 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Tue, 26 Nov 2019 00:30:18 +0000 Subject: [PATCH 06/16] env vars -> strings, remove homebridge port --- group_vars/all.yml.dist | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/group_vars/all.yml.dist b/group_vars/all.yml.dist index 769ea289..8e5a4240 100644 --- a/group_vars/all.yml.dist +++ b/group_vars/all.yml.dist @@ -367,9 +367,8 @@ plex_group_id: 0 ### homebridge_available_externally: "false" homebridge_config_directory: "{{ docker_home }}/homebridge/config" -homebridge_user_id: 0 -homebridge_group_id: 0 -homebridge_ui_port: 8087 +homebridge_user_id: "0" +homebridge_group_id: "0" ### ### Emby From 5ed14537bd297aa07300bb3383c22486a424f8f2 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Tue, 26 Nov 2019 00:30:52 +0000 Subject: [PATCH 07/16] Homebridge cleanup variables --- tasks/homebridge.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tasks/homebridge.yml b/tasks/homebridge.yml index d86cf55a..20e63ec0 100644 --- a/tasks/homebridge.yml +++ b/tasks/homebridge.yml @@ -3,7 +3,6 @@ file: path: "{{ item }}" state: directory - # mode: 0755 with_items: - "{{ homebridge_config_directory }}" @@ -13,18 +12,18 @@ image: oznu/homebridge pull: true volumes: - - "{{ homebridge_config_directory }}:/homebridge" + - "{{ homebridge_config_directory }}:/homebridge" network_mode: host env: TZ: "{{ ansible_nas_timezone }}" - PGID: "{{ homebridge_group_id | string }}" - PUID: "{{ homebridge_user_id | string }}" + PGID: "{{ homebridge_group_id }}" + PUID: "{{ homebridge_user_id }}" HOMEBRIDGE_CONFIG_UI: "1" - HOMEBRIDGE_CONFIG_UI_PORT: "{{ homebridge_ui_port | string }}" + HOMEBRIDGE_CONFIG_UI_PORT: "8087" restart_policy: unless-stopped memory: 1g labels: traefik.backend: "homebridge" traefik.frontend.rule: "Host:homebridge.{{ ansible_nas_domain }}" - traefik.enable: "{{ homebridge_available_externally | string }}" - traefik.port: "{{ homebridge_ui_port | string }}" + traefik.enable: "{{ homebridge_available_externally }}" + traefik.port: "8087" From 4f78d72f0e2c8e3aa7f790e33bfef7800d97d1d7 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Sat, 30 Nov 2019 08:05:05 +0000 Subject: [PATCH 08/16] Update bug-report.md --- .github/ISSUE_TEMPLATE/bug-report.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 09dec702..0efad171 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -21,7 +21,14 @@ A clear and concise description of what the bug is. - Ansible-NAS Docker version (`docker --version` on the Ansible-NAS box): - Latest Docker logs (`journalctl -u docker.service` on the Ansible-NAS box): - Are you running the playbook from a remote box or the Ansible-NAS box itself? -- Vagrant version, if testing (`vagrant --version`) +- Vagrant version, if testing (`vagrant --version`): +- Ansible-NAS filesystems (`df -h on the Ansible-NAS box`): + +**all.yml Variables** +- `docker_image_directory`: +- `docker_home`: +- `docker_storage_driver`: +- `samba_shares_root`: **Expected behavior** What should happen? From 88d06996a87799eb1796351d65b9c80cd71833b1 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Sun, 1 Dec 2019 08:23:38 +0000 Subject: [PATCH 09/16] Include filesystem types in bug report --- .github/ISSUE_TEMPLATE/bug-report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 0efad171..fc795fff 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -22,7 +22,7 @@ A clear and concise description of what the bug is. - Latest Docker logs (`journalctl -u docker.service` on the Ansible-NAS box): - Are you running the playbook from a remote box or the Ansible-NAS box itself? - Vagrant version, if testing (`vagrant --version`): -- Ansible-NAS filesystems (`df -h on the Ansible-NAS box`): +- Ansible-NAS filesystems (`df -hT on the Ansible-NAS box`): **all.yml Variables** - `docker_image_directory`: From fb14f83fa9ca8410b7cc4a5d831ec07b6ae52fd6 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Sun, 1 Dec 2019 08:28:57 +0000 Subject: [PATCH 10/16] Include mounts in bug reports --- .github/ISSUE_TEMPLATE/bug-report.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index fc795fff..6cd3b7e9 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -22,7 +22,8 @@ A clear and concise description of what the bug is. - Latest Docker logs (`journalctl -u docker.service` on the Ansible-NAS box): - Are you running the playbook from a remote box or the Ansible-NAS box itself? - Vagrant version, if testing (`vagrant --version`): -- Ansible-NAS filesystems (`df -hT on the Ansible-NAS box`): +- Ansible-NAS filesystems (`df -hT` on the Ansible-NAS box): +- Mounted filesystems (`mount` on the Ansible-NAS box) **all.yml Variables** - `docker_image_directory`: From d655583e4f628ea44cd58a63087f57f40eec9f8e Mon Sep 17 00:00:00 2001 From: Mark Scott Date: Sat, 7 Dec 2019 11:45:59 +0000 Subject: [PATCH 11/16] Enable auto-expansion using `zpool` rather than `zfs` Briefly highlight that a pool has properties that apply to itself or to its filesystems. --- docs/zfs/zfs_configuration.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/zfs/zfs_configuration.md b/docs/zfs/zfs_configuration.md index e068a7df..5af25537 100644 --- a/docs/zfs/zfs_configuration.md +++ b/docs/zfs/zfs_configuration.md @@ -102,24 +102,26 @@ Our new pool is named `tank` and is mirrored. To see information about it, use `ashift`), use `sudo zpool destroy tank` and start over _now_ before it's too late. -### Pool default parameters +### Pool and filesystem properties -Setting pool-wide default parameters makes life easier when we create our -filesystems. To see them all, you can use the command `zfs get all tank`. Most -are perfectly sensible, some you'll [want to -change](https://jrs-s.net/2018/08/17/zfs-tuning-cheat-sheet/): +Pools have properties that apply either to the pool itself or to filesystems +created in the pool. You can use the command `zpool get all tank` to see the +pool properties and `zfs get all tank` to see the filesystem properties. Most +default values are perfecly sensible, some you'll [want to +change](https://jrs-s.net/2018/08/17/zfs-tuning-cheat-sheet/). Setting +defaults makes life easier when we create our filesystems. ``` + sudo zpool set autoexpand=on tank sudo zfs set atime=off tank sudo zfs set compression=lz4 tank - sudo zfs set autoexpand=on tank ``` -The `atime` parameter means that your system updates a time stamp every time a -file is accessed, which uses a lot of resources. Usually, you don't care. +`autoexpand=on` lets the pool grow when you add larger hard drives. `atime=off` +means that your system won't update a time stamp every time a file is accessed, +something which would use a lot of resources. Usually, you don't care. Compression is a no-brainer on modern CPUs and should be on by default (we will -discuss exceptions for compressed media files later). The `autoexpand` lets the -pool grow when you add larger hard drives. +discuss exceptions for compressed media files later). ## Creating filesystems From 1ab1a1691e8e2a57c639cedf05147733fa66456f Mon Sep 17 00:00:00 2001 From: Mark Scott Date: Sun, 8 Dec 2019 22:16:24 +0000 Subject: [PATCH 12/16] Add user to `docker` group instead of setting it as their primary group --- tasks/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/docker.yml b/tasks/docker.yml index bfba1c6c..1b13dcfa 100644 --- a/tasks/docker.yml +++ b/tasks/docker.yml @@ -22,7 +22,7 @@ - name: add user account to docker group user: name: "{{ ansible_nas_user }}" - group: docker + groups: docker append: yes - name: update docker home from install default From 26977cc52354f2df36b3466b8910ef524ba5efd3 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Sat, 14 Dec 2019 22:36:51 +0000 Subject: [PATCH 13/16] add nofile ulimits to time machine docker container --- tasks/timemachine.yml | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/tasks/timemachine.yml b/tasks/timemachine.yml index 6e018bdf..1cdc550a 100644 --- a/tasks/timemachine.yml +++ b/tasks/timemachine.yml @@ -6,34 +6,36 @@ - name: Time Machine Docker Container docker_container: - 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: 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" + ulimits: + - "nofile:1048576:1048576" + network_mode: bridge + restart_policy: unless-stopped + memory: 1g - name: Install avahi apt: - name: "avahi-daemon" - state: present + 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" + src: timemachine/timemachine.service + dest: "/etc/avahi/services/timemachine.service" - name: Reload avahi configuration service: - name: avahi-daemon - state: reloaded + name: avahi-daemon + state: reloaded From cf86008b101daccfabbe79532145c84f0ecfb3f8 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Mon, 16 Dec 2019 17:44:03 +0000 Subject: [PATCH 14/16] Template TimeMachine share name into avahi config --- templates/timemachine/timemachine.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/timemachine/timemachine.service b/templates/timemachine/timemachine.service index 2b2ed4e9..cf0c6da5 100644 --- a/templates/timemachine/timemachine.service +++ b/templates/timemachine/timemachine.service @@ -5,7 +5,7 @@ _adisk._tcp sys=waMa=0,adVF=0x100 - dk0=adVN=Data,adVF=0x82 + dk0=adVN={{ timemachine_share_name }},adVF=0x82 _smb._tcp From af3200d802fb2295e2cfba3a39650e23cf0b098d Mon Sep 17 00:00:00 2001 From: Mark Scott Date: Fri, 27 Dec 2019 14:51:20 +0000 Subject: [PATCH 15/16] Quote the here document's delimiting identifier Quoting prevents interpretation of things like backslash characters. --- tests/test-vagrant.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-vagrant.sh b/tests/test-vagrant.sh index 22656d23..2a3f01b3 100755 --- a/tests/test-vagrant.sh +++ b/tests/test-vagrant.sh @@ -4,7 +4,7 @@ PLAYBOOK_DIR=$DIR/.. header() { clear - cat << EndOfMessage + cat << "EndOfMessage" ._____. .__ _____ ____ _____|__\_ |__ | | ____ ____ _____ ______ \__ \ / \ / ___/ || __ \| | _/ __ \ ______ / \\__ \ / ___/ From 1454fed0937673c4b4dd7a36894a8eeb3e3e13a9 Mon Sep 17 00:00:00 2001 From: David Stephens Date: Sun, 5 Jan 2020 09:14:42 +0000 Subject: [PATCH 16/16] Update contribution guidelines --- docs/contributing.md => CONTRIBUTING.md | 13 ++++++++++++- README.md | 14 +------------- 2 files changed, 13 insertions(+), 14 deletions(-) rename docs/contributing.md => CONTRIBUTING.md (60%) diff --git a/docs/contributing.md b/CONTRIBUTING.md similarity index 60% rename from docs/contributing.md rename to CONTRIBUTING.md index 28178e10..13f6d8fb 100644 --- a/docs/contributing.md +++ b/CONTRIBUTING.md @@ -11,4 +11,15 @@ If you're adding a new application: * Ensure that the new application is disabled by default. * Add a documentation page to `docs/applications/` - use an existing application as an example. -* Add the frontend port to `docs/configuration/application_ports.md`, ensuring you've not clashed with an existing application. \ No newline at end of file +* Add the frontend port to `docs/configuration/application_ports.md`, ensuring you've not clashed with an existing application. + +## Things to bear in mind + +* If you break the build with your PR, please fix it :) +* Pull requests that unintentionally touch files, or that show files as removed then re-added will be rejected. +* Please know that your efforts are appreciated, thanks! :+1: + +# Development Environment + +* Development of Ansible-NAS is carried out in [Visual Studio Code](https://code.visualstudio.com/) - you'll get some nice +recommended extensions and task setups if you do the same. \ No newline at end of file diff --git a/README.md b/README.md index 1d1ac31a..053db4e2 100644 --- a/README.md +++ b/README.md @@ -143,20 +143,8 @@ Getting help is easy! You can: ## Contributing -Contributions are welcome, please feel free to raise a PR! +Contributions are always welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) first. -* Restrict pull requests to one piece of functionality or bugfix at a time. -* Test your new functionality or bugfix using the included - `tests/test-vagrant.sh` script to spin up a test VM. Note that Ansible-NAS - requires Vagrant version 2.2.2 or later, so for stock Ubuntu 18.04.2, you will - have to download and install the newest version from - https://www.vagrantup.com/downloads.html. -* Run `ansible-lint` against the playbook before committing. (There is a VSCode - task set up to run the right command for you) -* Please know that your efforts are appreciated, thanks! :+1: - -Development of Ansible-NAS is carried out in [Visual Studio Code](https://code.visualstudio.com/) - you'll get some nice -recommended extensions and task setups if you do the same. ## Support