ansible-role-ntfy_service/tasks/configure.yml

59 lines
1.3 KiB
YAML
Raw Normal View History

2022-10-11 09:19:04 +02:00
---
- 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
2023-02-09 23:14:43 +01:00
notify: Restart ntfy
2022-10-11 09:19:04 +02:00
- 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
2023-02-09 23:14:43 +01:00
notify: Restart ntfy
2022-10-11 09:19:04 +02:00
- 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
2023-02-09 23:14:43 +01:00
notify: Restart ntfy
2022-10-11 09:19:04 +02:00
- name: Ensure attachments directory exists
file:
path: "{{ attachment_cache_dir }}"
owner: ntfy
group: ntfy
state: directory
mode: 0660
when: attachment_cache_dir is defined
2023-02-09 23:14:43 +01:00
notify: Restart ntfy
2022-10-11 09:19:04 +02:00
- 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 }}"
2023-02-09 23:14:43 +01:00
# loop: "{{ access_rules }}"