Initial commit with previous code
This commit is contained in:
commit
9f665a37d0
6 changed files with 117 additions and 0 deletions
31
defaults/main.yml
Normal file
31
defaults/main.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
create_cache_file: true
|
||||
auth_file: /var/lib/ntfy/auth.sqlite
|
||||
base_url: notify.koti.site
|
||||
listen_port: 4880
|
||||
attachment_cache_dir: /var/lib/ntfy/attachments
|
||||
attachment_total_size_limit: "100G"
|
||||
attachment_file_size_limit: "15M"
|
||||
attachment_expiry_duration: "8h"
|
||||
|
||||
# Full list in
|
||||
# https://ntfy.sh/docs/config/
|
||||
admin_accounts:
|
||||
- name: manager
|
||||
password: "{{ vault_manager_password }}"
|
||||
user_accounts: []
|
||||
access_rules:
|
||||
- username: manager
|
||||
topic: '*' # or something like mytopic* or my_topic
|
||||
permission: read-write # or read-only, write-only, deny
|
||||
ntfy_configuration:
|
||||
behind-proxy: false
|
||||
listen-http: ":4880"
|
||||
cache-file: /var/lib/ntfy.sqlite
|
||||
cache-duration: 24h
|
||||
auth-file: "{{ auth_file }}"
|
||||
auth-default-access: deny-all
|
||||
attachment-cache-dir: "{{ attachment_cache_dir }}"
|
||||
attachment-total-size-limit: "{{ attachment_total_size_limit }}"
|
||||
attachment-file-size-limit: "{{ attachment_file_size_limit }}"
|
||||
attachment-expiry-duration: "{{ attachment_expiry_duration }}"
|
3
handlers/main.yml
Normal file
3
handlers/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
# - name: Refresh aliases
|
||||
# shell: newaliases
|
54
tasks/configure.yml
Normal file
54
tasks/configure.yml
Normal file
|
@ -0,0 +1,54 @@
|
|||
---
|
||||
- name: Configure ntfy
|
||||
copy:
|
||||
content: "{{ ntfy_configuration | to_nice_yaml(indent=4, width=250) }}"
|
||||
dest: /etc/ntfy/server.yml
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0664'
|
||||
backup: yes
|
||||
|
||||
- name: Ensure cache file is accessible to ntfy
|
||||
file:
|
||||
path: "{{ cache_file }}"
|
||||
owner: ntfy
|
||||
group: ntfy
|
||||
state: touch
|
||||
mode: 0660
|
||||
when: cache_file is defined
|
||||
|
||||
- name: Ensure auth file is accessible to ntfy
|
||||
file:
|
||||
path: "{{ auth_file }}"
|
||||
owner: ntfy
|
||||
group: ntfy
|
||||
state: touch
|
||||
mode: 0660
|
||||
when: auth_file is defined
|
||||
|
||||
- name: Ensure attachments directory exists
|
||||
file:
|
||||
path: "{{ attachment_cache_dir }}"
|
||||
owner: ntfy
|
||||
group: ntfy
|
||||
state: directory
|
||||
mode: 0660
|
||||
when: attachment_cache_dir is defined
|
||||
|
||||
- name: Ensure ntfy is enabled and started
|
||||
systemd:
|
||||
name: ntfy
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
# - name: Configure administrators
|
||||
# shell: "ntfy user add --role=admin {{ item.name }}"
|
||||
# loop: "{{ admin_accounts }}"
|
||||
|
||||
# - name: Configure users
|
||||
# shell: "ntfy user add --role=user {{ item.name }}"
|
||||
# loop: "{{ user_accounts }}"
|
||||
|
||||
# - name: Grant permissions
|
||||
# shell: "ntfy access {{ item.username }} {{ item.topic }} {{ item.permission }}"
|
||||
# loop: "{{ access_rules }}"
|
19
tasks/install.yml
Normal file
19
tasks/install.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
- name: Ensure repository key is present
|
||||
apt_key:
|
||||
id: CF871F1E8399DAEF470832661D5B8EDFB2476E53
|
||||
url: https://archive.heckel.io/apt/pubkey.txt
|
||||
keyring: /etc/apt/trusted.gpg.d/heckel.gpg
|
||||
|
||||
- name: Install software required
|
||||
apt:
|
||||
name: apt-transport-https
|
||||
|
||||
- name: Ensure repository is present
|
||||
apt_repository:
|
||||
repo: deb [arch=amd64] https://archive.heckel.io/apt debian main
|
||||
filename: heckel
|
||||
state: present
|
||||
- name: Ensure ntfy is installed
|
||||
apt:
|
||||
name: ntfy
|
5
tasks/main.yml
Normal file
5
tasks/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Ensure installation
|
||||
include_tasks: install.yml
|
||||
- name: Ensure configuration
|
||||
include_tasks: configure.yml
|
5
templates/server.yml.j2
Normal file
5
templates/server.yml.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
{% if ntfy_configuration is defined %}
|
||||
{% for key, value in ntfy_configuration.items() %}
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
Loading…
Reference in a new issue