Skip to content

Commit

Permalink
add notifiarr
Browse files Browse the repository at this point in the history
  • Loading branch information
ahembree committed Aug 22, 2024
1 parent 5d915fa commit 2daab9e
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Ansible Playbook to setup an automated Home Media Server stack running on Docker
- [Kavita](https://hub.docker.com/r/kizaing/kavita): digital library
- [Unpackerr](https://github.com/Unpackerr/unpackerr): download decompression
- [Autobrr](https://github.com/autobrr/autobrr): torrent automation

- [Notifiarr](https://github.com/Notifiarr/notifiarr): notification system

## Other Features

Expand Down
1 change: 1 addition & 0 deletions docs/Container Map.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ If you choose to expose the container ports on the host (by setting `container_e
| Maintainerr | ☐ | `maintainerr` | `6246` | `6246` | ☑ |
| Lidarr | ☐ | `lidarr` | `8686` | `8686` | ☑ |
| Autobrr | ☐ | `autobrr` | `7474` | `7474` | ☑ |
| Notifiarr | ☐ | `notifiarr` | `5454` | `5454` | ☑ |

If both Jellyfin and Emby are enabled, then Emby will be available on ports `8097` and `8921` (if ports are being exposed for both)
8 changes: 8 additions & 0 deletions roles/hmsdocker/defaults/main/container_map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,12 @@ hms_docker_container_map:
expose_to_public: no
homepage: yes
homepage_stats: yes
notifiarr:
enabled: no
proxy_host_rule: notifiarr
directory: yes
traefik: yes
authentik: no
authentik_provider_type: proxy
expose_to_public: no

6 changes: 6 additions & 0 deletions roles/hmsdocker/defaults/main/service_misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ tdarr_enable_node_server: no



#######################################################################
### Notifiarr settings
hmsdocker_notifiarr_api_key:
### End Notifiarr settings
#######################################################################

#######################################################################
### Tautulli settings
# Downloads and includes the JBOPS scripts from https://github.com/blacktwin/JBOPS to the Tautulli container
Expand Down
12 changes: 12 additions & 0 deletions roles/hmsdocker/tasks/generate_compose_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,15 @@
trim_blocks: yes
lstrip_blocks: yes
register: autobrr_compose_file

- name: Generate Docker Compose file for Notifiarr
when: hmsdocker_container_enabled_notifiarr
ansible.builtin.template:
src: containers/notifiarr.yml.j2
dest: "{{ compose_dir.dest | default(hms_docker_data_path + '/compose_files') }}/notifiarr.yml"
owner: "{{ container_uid }}"
group: "{{ container_gid }}"
mode: 0644
trim_blocks: yes
lstrip_blocks: yes
register: notifiarr_compose_file
82 changes: 82 additions & 0 deletions roles/hmsdocker/templates/containers/notifiarr.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
services:
notifiarr:
image: golift/notifiarr:latest
container_name: notifiarr
hostname: notifiarr-hmsd
restart: ${RESTART_POLICY}
logging:
options:
max-size: "12m"
max-file: "5"
driver: json-file
networks:
- proxy_net
{% if hmsdocker_expose_ports_enabled_notifiarr %}
ports:
- 5454:5454
{% endif %}
volumes:
- ${HMSD_APPS_PATH}/notifiarr/config:/config
- /var/run/utmp:/var/run/utmp
- /etc/machine-id:/etc/machine-id
environment:
- DN_API_KEY=${NOTIFIARR_API_KEY}
{% if hmsdocker_container_enabled_lidarr %}
- DN_LIDARR_0_NAME=Lidarr
- DN_LIDARR_0_URL=http://lidarr:8686
- DN_LIDARR_0_API_KEY=${LIDARR_KEY}
{% endif %}
{% if hmsdocker_container_enabled_prowlarr %}
- DN_PROWLARR_0_NAME=Prowlarr
- DN_PROWLARR_0_URL=http://prowlarr:9696
- DN_PROWLARR_0_API_KEY=${PROWLARR_KEY}
{% endif %}
{% if hmsdocker_container_enabled_radarr %}
- DN_RADARR_0_NAME=Radarr
- DN_RADARR_0_URL=http://radarr:7878
- DN_RADARR_0_API_KEY=${RADARR_KEY}
{% if separate_4k_instances_enable %}
- DN_RADARR_1_NAME=Radarr-{{ separate_4k_instances_suffix }}
- DN_RADARR_1_URL=http://radarr-{{ separate_4k_instances_suffix }}:7878
- DN_RADARR_1_API_KEY=${RADARR_4K_KEY}
{% endif %}
{% endif %}
{% if hmsdocker_container_enabled_readarr %}
- DN_READARR_0_NAME=Readarr
- DN_READARR_0_URL=http://readarr:8787
- DN_READARR_0_API_KEY=${READARR_KEY}
{% endif %}
{% if hmsdocker_container_enabled_sonarr %}
- DN_SONARR_0_NAME=Sonarr
- DN_SONARR_0_URL=http://sonarr:8989
- DN_SONARR_0_API_KEY=${SONARR_KEY}
{% if separate_4k_instances_enable %}
- DN_SONARR_1_NAME=Sonarr-{{ separate_4k_instances_suffix }}
- DN_SONARR_1_URL=http://sonarr-{{ separate_4k_instances_suffix }}:8989
- DN_SONARR_1_API_KEY=${SONARR_4K_KEY}
{% endif %}
{% endif %}
{% if hmsdocker_container_enabled_sabnzbd %}
- DN_SABNZBD_0_NAME=SABnzbd
- DN_SABNZBD_0_URL=http://sabnzbd:8080
- DN_SABNZBD_0_API_KEY=${SABNZBD_KEY}
{% endif %}
{% if hmsdocker_container_enabled_plex %}
- DN_PLEX_NAME=Plex
- DN_PLEX_URL=http://plex:32400
- DN_PLEX_TOKEN=${PLEX_KEY}
{% endif %}
{% if hmsdocker_traefik_enabled_notifiarr or hmsdocker_homepage_enabled_notifiarr %}
labels:
{% if hmsdocker_traefik_enabled_notifiarr %}
- traefik.enable=true
- traefik.http.services.notifiarr-${COMPOSE_PROJECT}.loadbalancer.server.port=5454
- traefik.http.routers.notifiarr-${COMPOSE_PROJECT}.rule=Host(`{{ hms_docker_container_map['notifiarr']['proxy_host_rule'] | default('notifiarr') }}.${HMSD_DOMAIN}`)
{% if not hmsdocker_expose_public_enabled_notifiarr %}
- traefik.http.routers.notifiarr-${COMPOSE_PROJECT}.middlewares=internal-ipallowlist@file
{% endif %}
{% if hmsdocker_authentik_enabled_notifiarr %}
- traefik.http.routers.notifiarr-${COMPOSE_PROJECT}.middlewares=authentik-proxy-${COMPOSE_PROJECT}-notifiarr-midware@docker
{% endif %}
{% endif %}
{% endif %}
3 changes: 3 additions & 0 deletions roles/hmsdocker/templates/docker-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,9 @@ include:
{% if hmsdocker_container_enabled_autobrr %}
- compose_files/autobrr.yml
{% endif %}
{% if hmsdocker_container_enabled_notifiarr %}
- compose_files/notifiarr.yml
{% endif %}
networks:
"download_net":
driver: bridge
Expand Down
40 changes: 4 additions & 36 deletions roles/hmsdocker/templates/env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -80,61 +80,29 @@ TAILSCALE_AUTH_KEY={{ tailscale_auth_key }}
### END Tailscale
{% endif %}

{% if hmsdocker_container_enabled_homepage %}
### BEGIN Homepage
{% if hmsdocker_homepage_enabled_sonarr and hmsdocker_container_enabled_sonarr %}
### BEGIN App API Keys
NOTIFIARR_API_KEY={{ hmsdocker_notifiarr_api_key | default('') }}
SONARR_KEY={{ sonarr_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
SONARR_4K_KEY={{ sonarr_4k_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
{% if hmsdocker_homepage_enabled_radarr and hmsdocker_container_enabled_radarr %}
RADARR_KEY={{ radarr_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
RADARR_4K_KEY={{ radarr_4k_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
{% if hmsdocker_homepage_enabled_prowlarr and hmsdocker_container_enabled_prowlarr %}
PROWLARR_KEY={{ prowlarr_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
{% if hmsdocker_homepage_enabled_sabnzbd and hmsdocker_container_enabled_sabnzbd %}
SABNZBD_KEY={{ sabnzbd_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
{% if hmsdocker_homepage_enabled_nzbget and hmsdocker_container_enabled_nzbget %}
NZBGET_KEY={{ homepage_nzbget_key | default('') }}
{% endif %}
{% if hmsdocker_homepage_enabled_tautulli and hmsdocker_container_enabled_tautulli %}
TAUTULLI_KEY={{ tautulli_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
{% if hmsdocker_homepage_enabled_plex and hmsdocker_container_enabled_plex %}
PLEX_KEY={{ plex_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
{% if hmsdocker_homepage_enabled_overseerr and hmsdocker_container_enabled_overseerr %}
OVERSEERR_KEY={{ overseerr_key.main.apiKey | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
{% if hmsdocker_homepage_enabled_bazarr and hmsdocker_container_enabled_bazarr %}
BAZARR_KEY={{ bazarr_key.auth.apikey | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
{% if hmsdocker_homepage_enabled_authentik and hmsdocker_container_enabled_authentik %}
AUTHENTIK_KEY={{ homepage_authentik_key | default('') }}
{% endif %}
{% if hmsdocker_homepage_enabled_portainer and hmsdocker_container_enabled_portainer %}
PORTAINER_KEY={{ homepage_portainer_key | default('') }}
{% endif %}
{% if hmsdocker_homepage_enabled_readarr and hmsdocker_container_enabled_readarr %}
READARR_KEY={{ readarr_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
WATCHTOWER_KEY={{ watchtower_key | default('') }}
{% if hmsdocker_homepage_enabled_jellyfin and hmsdocker_container_enabled_jellyfin %}
JELLYFIN_KEY={{ homepage_jellyfin_key | default('') }}
{% endif %}
{% if hmsdocker_homepage_enabled_emby and hmsdocker_container_enabled_emby %}
EMBY_KEY={{ homepage_emby_key | default('') }}
{% endif %}
{% if hmsdocker_homepage_enabled_lidarr and hmsdocker_container_enabled_lidarr %}
LIDARR_KEY={{ lidarr_key | default('# Will be obtained on 2nd run of playbook' if ansible_check_mode else '') }}
{% endif %}
{% if hmsdocker_homepage_enabled_autobrr and hmsdocker_container_enabled_autobrr %}
AUTOBRR_KEY={{ homepage_autobrr_key | default('') }}
{% endif %}
### END Homepage
{% endif %}
### END App API Keys


{% if monitoring_scripts_enabled %}
### BEGIN Custom Monitoring Scripts
Expand Down
5 changes: 5 additions & 0 deletions roles/hmsdocker/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ hmsdocker_container_enabled_maintainerr: "{{ hms_docker_container_map['maintaine
hmsdocker_container_enabled_unpackerr: "{{ hms_docker_container_map['unpackerr']['enabled'] | default(False) }}"
hmsdocker_container_enabled_lidarr: "{{ hms_docker_container_map['lidarr']['enabled'] | default(False) }}"
hmsdocker_container_enabled_autobrr: "{{ hms_docker_container_map['autobrr']['enabled'] | default(False) }}"
hmsdocker_container_enabled_notifiarr: "{{ hms_docker_container_map['notifiarr']['enabled'] | default(False) }}"


# Traefik computed variables
Expand Down Expand Up @@ -66,6 +67,7 @@ hmsdocker_traefik_enabled_emby: "{{ hms_docker_container_map['emby']['traefik']
hmsdocker_traefik_enabled_maintainerr: "{{ hms_docker_container_map['maintainerr']['traefik'] | default(False) and hmsdocker_container_enabled_traefik }}"
hmsdocker_traefik_enabled_lidarr: "{{ hms_docker_container_map['lidarr']['traefik'] | default(False) and hmsdocker_container_enabled_traefik }}"
hmsdocker_traefik_enabled_autobrr: "{{ hms_docker_container_map['autobrr']['traefik'] | default(False) and hmsdocker_container_enabled_traefik }}"
hmsdocker_traefik_enabled_notifiarr: "{{ hms_docker_container_map['notifiarr']['traefik'] | default(False) and hmsdocker_container_enabled_traefik }}"


# Public container exposure computed variables
Expand Down Expand Up @@ -95,6 +97,7 @@ hmsdocker_expose_public_enabled_emby: "{{ hms_docker_container_map['emby']['expo
hmsdocker_expose_public_enabled_maintainerr: "{{ hms_docker_container_map['maintainerr']['expose_to_public'] | default(False) }}"
hmsdocker_expose_public_enabled_lidarr: "{{ hms_docker_container_map['lidarr']['expose_to_public'] | default(False) }}"
hmsdocker_expose_public_enabled_autobrr: "{{ hms_docker_container_map['autobrr']['expose_to_public'] | default(False) }}"
hmsdocker_expose_public_enabled_notifiarr: "{{ hms_docker_container_map['notifiarr']['expose_to_public'] | default(False) }}"


# Container host port mapping computed variables
Expand Down Expand Up @@ -125,6 +128,7 @@ hmsdocker_expose_ports_enabled_emby: "{{ True if (container_expose_ports or not
hmsdocker_expose_ports_enabled_maintainerr: "{{ True if (container_expose_ports or not hmsdocker_container_enabled_traefik or not hmsdocker_traefik_enabled_maintainerr) else False }}"
hmsdocker_expose_ports_enabled_lidarr: "{{ True if (container_expose_ports or not hmsdocker_container_enabled_traefik or not hmsdocker_traefik_enabled_lidarr) else False }}"
hmsdocker_expose_ports_enabled_autobrr: "{{ True if (container_expose_ports or not hmsdocker_container_enabled_traefik or not hmsdocker_traefik_enabled_autobrr) else False }}"
hmsdocker_expose_ports_enabled_notifiarr: "{{ True if (container_expose_ports or not hmsdocker_container_enabled_traefik or not hmsdocker_traefik_enabled_notifiarr) else False }}"

# Authentik computed variables
# Controls global authentik variables
Expand Down Expand Up @@ -158,6 +162,7 @@ hmsdocker_authentik_enabled_emby: "{{ hms_docker_container_map['emby']['authenti
hmsdocker_authentik_enabled_maintainerr: "{{ hms_docker_container_map['maintainerr']['authentik'] | default(False) and hmsdocker_authentik_enabled_globally and hms_docker_container_map['maintainerr']['authentik_provider_type'] == 'proxy' | default(False) }}"
hmsdocker_authentik_enabled_lidarr: "{{ hms_docker_container_map['lidarr']['authentik'] | default(False) and hmsdocker_authentik_enabled_globally and hms_docker_container_map['lidarr']['authentik_provider_type'] == 'proxy' | default(False) }}"
hmsdocker_authentik_enabled_autobrr: "{{ hms_docker_container_map['autobrr']['authentik'] | default(False) and hmsdocker_authentik_enabled_globally and hms_docker_container_map['autobrr']['authentik_provider_type'] == 'proxy' | default(False) }}"
hmsdocker_authentik_enabled_notifiarr: "{{ hms_docker_container_map['notifiarr']['authentik'] | default(False) and hmsdocker_authentik_enabled_globally and hms_docker_container_map['notifiarr']['authentik_provider_type'] == 'proxy' | default(False) }}"


# Homepage
Expand Down

0 comments on commit 2daab9e

Please sign in to comment.