homelab/roles/ntfy-server/tasks/main.yml

51 lines
1.0 KiB
YAML
Raw Normal View History

---
- name: Ensure system group exists
ansible.builtin.group:
name: 'ntfy'
gid: 203
system: true
state: present
- name: Ensure system user exists
ansible.builtin.user:
name: 'ntfy'
group: 'ntfy'
uid: 203
system: true
create_home: false
- name: Ensure data subvolume is present
community.general.btrfs_subvolume:
name: '/ntfy'
- name: Ensure data subvolume permissions are correct
ansible.builtin.file:
path: '/mnt/data1/ntfy'
state: directory
mode: '0755'
owner: 'ntfy'
group: 'ntfy'
- name: Ensure attachment directory is present
ansible.builtin.file:
path: '/mnt/data1/ntfy/attachments'
state: directory
mode: '0755'
owner: 'ntfy'
group: 'ntfy'
- name: Ensure server config file is present
ansible.builtin.copy:
src: 'server.yml'
dest: '/etc/ntfy/server.yml'
mode: '0644'
owner: 'root'
group: 'root'
notify: 'ntfy-restart'
- name: Ensure service is running & enabled
service:
name: ntfy
state: started
enabled: true