feat(ntfy): added server & client config
This commit is contained in:
parent
b1d70248f1
commit
a05cbf9a6f
14 changed files with 577 additions and 31 deletions
32
roles/ntfy/tasks/main.yml
Normal file
32
roles/ntfy/tasks/main.yml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
- name: Ensure repository GPG key is present
|
||||
ansible.builtin.apt_key:
|
||||
url: 'https://archive.heckel.io/apt/pubkey.txt'
|
||||
state: present
|
||||
|
||||
- name: Ensure Apt repository is present
|
||||
apt_repository:
|
||||
repo: 'deb [arch=arm64] https://archive.heckel.io/apt debian main'
|
||||
filename: ntfy
|
||||
state: present
|
||||
|
||||
- name: Ensure ntfy is installed
|
||||
apt:
|
||||
name: ntfy
|
||||
state: present
|
||||
|
||||
- name: Ensure configuration directory is present
|
||||
ansible.builtin.file:
|
||||
path: '/etc/ntfy'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
|
||||
- name: Ensure client config file is present
|
||||
ansible.builtin.template:
|
||||
src: 'client.yml.j2'
|
||||
dest: '/etc/ntfy/client.yml'
|
||||
mode: '0644'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
57
roles/ntfy/templates/client.yml.j2
Normal file
57
roles/ntfy/templates/client.yml.j2
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# ntfy client config file
|
||||
|
||||
# Base URL used to expand short topic names in the "ntfy publish" and "ntfy subscribe" commands.
|
||||
# If you self-host a ntfy server, you'll likely want to change this.
|
||||
#
|
||||
default-host: http://{{ hostvars[groups['ntfyserver'][0]].static_ip }}:8003
|
||||
|
||||
# Default credentials will be used with "ntfy publish" and "ntfy subscribe" if no other credentials are provided.
|
||||
# You can set a default token to use or a default user:password combination, but not both. For an empty password,
|
||||
# use empty double-quotes ("").
|
||||
#
|
||||
# To override the default user:password combination or default token for a particular subscription (e.g., to send
|
||||
# no Authorization header), set the user:pass/token for the subscription to empty double-quotes ("").
|
||||
|
||||
# default-token:
|
||||
|
||||
default-user: pi
|
||||
default-password: '{{ ntfy_user_pi_pass }}'
|
||||
|
||||
# Default command will execute after "ntfy subscribe" receives a message if no command is provided in subscription below
|
||||
# default-command:
|
||||
|
||||
# Subscriptions to topics and their actions. This option is primarily used by the systemd service,
|
||||
# or if you cann "ntfy subscribe --from-config" directly.
|
||||
#
|
||||
# Example:
|
||||
# subscribe:
|
||||
# - topic: mytopic
|
||||
# command: /usr/local/bin/mytopic-triggered.sh
|
||||
# - topic: myserver.com/anothertopic
|
||||
# command: 'echo "$message"'
|
||||
# if:
|
||||
# priority: high,urgent
|
||||
# - topic: secret
|
||||
# command: 'notify-send "$m"'
|
||||
# user: phill
|
||||
# password: mypass
|
||||
# - topic: token_topic
|
||||
# token: tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2
|
||||
#
|
||||
# Variables:
|
||||
# Variable Aliases Description
|
||||
# --------------- --------------------- -----------------------------------
|
||||
# $NTFY_ID $id Unique message ID
|
||||
# $NTFY_TIME $time Unix timestamp of the message delivery
|
||||
# $NTFY_TOPIC $topic Topic name
|
||||
# $NTFY_MESSAGE $message, $m Message body
|
||||
# $NTFY_TITLE $title, $t Message title
|
||||
# $NTFY_PRIORITY $priority, $prio, $p Message priority (1=min, 5=max)
|
||||
# $NTFY_TAGS $tags, $tag, $ta Message tags (comma separated list)
|
||||
# $NTFY_RAW $raw Raw JSON message
|
||||
#
|
||||
# Filters ('if:'):
|
||||
# You can filter 'message', 'title', 'priority' (comma-separated list, logical OR)
|
||||
# and 'tags' (comma-separated list, logical AND). See https://ntfy.sh/docs/subscribe/api/#filter-messages.
|
||||
#
|
||||
# subscribe:
|
||||
Loading…
Add table
Add a link
Reference in a new issue