| @@ -19,12 +19,13 @@ matrix_ntfy_enabled: true | |||||
| # Some other options | # Some other options | ||||
| matrix_server_fqn_ntfy: "ntfy.{{ matrix_domain }}" | matrix_server_fqn_ntfy: "ntfy.{{ matrix_domain }}" | ||||
| matrix_ntfy_container_extra_arguments: [ '--env=NTFY_LOG_LEVEL=DEBUG' ] | |||||
| matrix_ntfy_configuration_extension_yaml: | | |||||
| log_level: DEBUG | |||||
| ``` | ``` | ||||
| For a more complete list of variables that you could override, see `roles/matrix-ntfy/defaults/main.yml`. | For a more complete list of variables that you could override, see `roles/matrix-ntfy/defaults/main.yml`. | ||||
| For a complete list of ntfy config options that you could put in `matrix_ntfy_container_extra_arguments`, see the [ntfy config documentation](https://ntfy.sh/docs/config/#config-options). | |||||
| For a complete list of ntfy config options that you could put in `matrix_ntfy_configuration_extension_yaml`, see the [ntfy config documentation](https://ntfy.sh/docs/config/#config-options). | |||||
| ## Installing | ## Installing | ||||
| @@ -2,6 +2,7 @@ | |||||
| matrix_ntfy_enabled: true | matrix_ntfy_enabled: true | ||||
| matrix_ntfy_base_path: "{{ matrix_base_data_path }}/ntfy" | matrix_ntfy_base_path: "{{ matrix_base_data_path }}/ntfy" | ||||
| matrix_ntfy_config_dir_path: "{{ matrix_ntfy_base_path }}/config" | |||||
| matrix_ntfy_data_path: "{{ matrix_ntfy_base_path }}/data" | matrix_ntfy_data_path: "{{ matrix_ntfy_base_path }}/data" | ||||
| matrix_ntfy_version: v1.27.2 | matrix_ntfy_version: v1.27.2 | ||||
| @@ -21,3 +22,25 @@ matrix_ntfy_container_extra_arguments: [] | |||||
| # Controls whether the self-check feature should validate SSL certificates. | # Controls whether the self-check feature should validate SSL certificates. | ||||
| matrix_ntfy_self_check_validate_certificates: true | matrix_ntfy_self_check_validate_certificates: true | ||||
| # Default ntfy configuration template which covers the generic use case. | |||||
| # You can customize it by controlling the various variables inside it. | |||||
| # | |||||
| # For a more advanced customization, you can extend the default (see `matrix_ntfy_configuration_extension_yaml`) | |||||
| # or completely replace this variable with your own template. | |||||
| matrix_ntfy_configuration_yaml: "{{ lookup('template', 'templates/ntfy/server.yml.j2') }}" | |||||
| matrix_ntfy_configuration_extension_yaml: | | |||||
| # Your custom YAML configuration for ntfy goes here. | |||||
| # This configuration extends the default starting configuration (`matrix_ntfy_configuration_yaml`). | |||||
| # | |||||
| # You can override individual variables from the default configuration, or introduce new ones. | |||||
| # | |||||
| # If you need something more special, you can take full control by | |||||
| # completely redefining `matrix_ntfy_configuration_yaml`. | |||||
| matrix_ntfy_configuration_extension: "{{ matrix_ntfy_configuration_extension_yaml|from_yaml if matrix_ntfy_configuration_extension_yaml|from_yaml is mapping else {} }}" | |||||
| # Holds the final ntfy configuration (a combination of the default and its extension). | |||||
| # You most likely don't need to touch this variable. Instead, see `matrix_ntfy_configuration_yaml`. | |||||
| matrix_ntfy_configuration: "{{ matrix_ntfy_configuration_yaml|from_yaml|combine(matrix_ntfy_configuration_extension, recursive=True) }}" | |||||
| @@ -20,8 +20,17 @@ | |||||
| group: "{{ matrix_user_groupname }}" | group: "{{ matrix_user_groupname }}" | ||||
| with_items: | with_items: | ||||
| - "{{ matrix_ntfy_base_path }}" | - "{{ matrix_ntfy_base_path }}" | ||||
| - "{{ matrix_ntfy_config_dir_path }}" | |||||
| - "{{ matrix_ntfy_data_path }}" | - "{{ matrix_ntfy_data_path }}" | ||||
| - name: Ensure matrix-ntfy config installed | |||||
| copy: | |||||
| content: "{{ matrix_ntfy_configuration|to_nice_yaml(indent=2, width=999999) }}" | |||||
| dest: "{{ matrix_ntfy_config_dir_path }}/server.yml" | |||||
| mode: 0644 | |||||
| owner: "{{ matrix_user_username }}" | |||||
| group: "{{ matrix_user_groupname }}" | |||||
| - name: Ensure matrix-ntfy.service installed | - name: Ensure matrix-ntfy.service installed | ||||
| template: | template: | ||||
| src: "{{ role_path }}/templates/systemd/matrix-ntfy.service.j2" | src: "{{ role_path }}/templates/systemd/matrix-ntfy.service.j2" | ||||
| @@ -0,0 +1,3 @@ | |||||
| base_url: {{ matrix_ntfy_base_url }} | |||||
| behind_proxy: true | |||||
| cache_file: /data/cache.db | |||||
| @@ -23,11 +23,10 @@ ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-ntfy \ | |||||
| {% if matrix_ntfy_container_http_host_bind_port %} | {% if matrix_ntfy_container_http_host_bind_port %} | ||||
| -p {{ matrix_ntfy_container_http_host_bind_port }}:80 \ | -p {{ matrix_ntfy_container_http_host_bind_port }}:80 \ | ||||
| {% endif %} | {% endif %} | ||||
| --mount type=bind,src={{ matrix_ntfy_config_dir_path }},dst=/etc/ntfy,ro \ | |||||
| --mount type=bind,src={{ matrix_ntfy_data_path }},dst=/data \ | --mount type=bind,src={{ matrix_ntfy_data_path }},dst=/data \ | ||||
| --env NTFY_CACHE_FILE=/data/cache.db \ | |||||
| --env NTFY_BASE_URL={{ matrix_ntfy_base_url }} \ | |||||
| {{ matrix_ntfy_docker_image }} \ | {{ matrix_ntfy_docker_image }} \ | ||||
| serve --behind-proxy | |||||
| serve | |||||
| ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-ntfy 2>/dev/null || true' | ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-ntfy 2>/dev/null || true' | ||||
| ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-ntfy 2>/dev/null || true' | ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-ntfy 2>/dev/null || true' | ||||