diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 09dec702..6cd3b7e9 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -21,7 +21,15 @@ 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 -hT` on the Ansible-NAS box): +- Mounted filesystems (`mount` on the Ansible-NAS box) + +**all.yml Variables** +- `docker_image_directory`: +- `docker_home`: +- `docker_storage_driver`: +- `samba_shares_root`: **Expected behavior** What should happen? 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 7fe3c1ca..c7801e17 100644 --- a/README.md +++ b/README.md @@ -145,20 +145,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 diff --git a/docs/applications/homebridge.md b/docs/applications/homebridge.md new file mode 100644 index 00000000..645df83d --- /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. The default username and password is 'admin' - change this after your first login! diff --git a/docs/configuration/application_ports.md b/docs/configuration/application_ports.md index 0afd1527..c39a574c 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 | 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 diff --git a/group_vars/all.yml.dist b/group_vars/all.yml.dist index c605861a..99b74c3f 100644 --- a/group_vars/all.yml.dist +++ b/group_vars/all.yml.dist @@ -41,9 +41,6 @@ radarr_enabled: false get_iplayer_enabled: false jackett_enabled: false bazarr_enabled: false - - -# Ombi ombi_enabled: false # Music @@ -64,7 +61,6 @@ watchtower_enabled: false cloudflare_ddns_enabled: false cloudcmd_enabled: false - # Backup & Restore duplicati_enabled: false nextcloud_enabled: false @@ -87,13 +83,12 @@ wallabag_enabled: false # Home Automation homeassistant_enabled: false mosquitto_enabled: false +homebridge_enabled: false +openhab_enabled: false # Calibre calibre_enabled: false -# Smarthome -openhab_enabled: false - # Joomla joomla_enabled: false @@ -368,6 +363,14 @@ plex_music_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" + ### ### Emby ### diff --git a/nas.yml b/nas.yml index 7e4a7d45..3a281aa7 100644 --- a/nas.yml +++ b/nas.yml @@ -176,6 +176,10 @@ when: (mosquitto_enabled | default(False)) tags: mosquitto + - import_tasks: tasks/homebridge.yml + when: (homebridge_enabled | default(False)) + tags: homebridge + - import_tasks: tasks/calibre.yml when: (calibre_enabled | default(False)) tags: calibre 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 diff --git a/tasks/homebridge.yml b/tasks/homebridge.yml new file mode 100644 index 00000000..20e63ec0 --- /dev/null +++ b/tasks/homebridge.yml @@ -0,0 +1,29 @@ +--- +- name: Create Homebridge Directories + file: + path: "{{ item }}" + state: directory + 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: "8087" + restart_policy: unless-stopped + memory: 1g + labels: + traefik.backend: "homebridge" + traefik.frontend.rule: "Host:homebridge.{{ ansible_nas_domain }}" + traefik.enable: "{{ homebridge_available_externally }}" + traefik.port: "8087" 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 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 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" ._____. .__ _____ ____ _____|__\_ |__ | | ____ ____ _____ ______ \__ \ / \ / ___/ || __ \| | _/ __ \ ______ / \\__ \ / ___/