64 lines
1.4 KiB
YAML
64 lines
1.4 KiB
YAML
---
|
|
- 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
|
|
notify: Restart ntfy
|
|
|
|
- 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
|
|
notify: Restart ntfy
|
|
|
|
- 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
|
|
notify: Restart ntfy
|
|
|
|
- name: Ensure attachments directory exists
|
|
file:
|
|
path: "{{ attachment_cache_dir }}"
|
|
owner: ntfy
|
|
group: ntfy
|
|
state: directory
|
|
mode: 0660
|
|
when: attachment_cache_dir is defined
|
|
notify: Restart ntfy
|
|
|
|
- name: Ensure ntfy is enabled and started
|
|
systemd:
|
|
name: ntfy
|
|
state: started
|
|
enabled: true
|
|
|
|
- name: Ensure UFW allow traffic to port
|
|
ufw:
|
|
rule: allow
|
|
port: "{{ listen_port }}"
|
|
when: handle_ufw
|
|
|
|
# - 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 }}"
|