### Description This PR adds a new `ntfy_server` role to configure, start, and test a ntfy container. This container is designed to be secure by default by requiring auth by default ### Related Issue Closes #15 ### Testing Done - [x] verified new container file was created correctly\ - [x] verified ntfy server webui is working and requires auth - [x] verified with automated test that ntfy server is working and accepting post requests ### Checklist - [x] My code follows the project's style guidelines. - [x] I have performed a self-review of my own code. - [x] I have updated the documentation (if necessary). --------- Co-authored-by: Jordan Del Pilar <[email protected]> Reviewed-on: #20
41 lines
1023 B
YAML
41 lines
1023 B
YAML
---
|
|
- name: Create ntfy Directories
|
|
ansible.builtin.file:
|
|
path: "{{ podman_config_base_dir }}/{{ ntfy_name }}/{{ item }}"
|
|
state: directory
|
|
mode: "0755"
|
|
loop:
|
|
- "/cache"
|
|
- "/auth"
|
|
|
|
- name: Create ntfy Quadlet
|
|
ansible.builtin.template:
|
|
src: ntfy.container.j2
|
|
dest: "{{ podman_quadlet_base_dir }}/management/{{ ntfy_name }}.container"
|
|
owner: "{{ ansible_user }}"
|
|
mode: "644"
|
|
notify: Restart ntfy on Change
|
|
|
|
- name: Flush Handlers
|
|
ansible.builtin.meta: flush_handlers
|
|
|
|
- name: Start ntfy Servers
|
|
ansible.builtin.systemd:
|
|
name: "{{ ntfy_name }}"
|
|
state: started
|
|
scope: user
|
|
|
|
- name: Verify server is running
|
|
ansible.builtin.uri:
|
|
url: "https://{{ ntfy_url }}/ansible_test"
|
|
method: POST
|
|
body: "Deployment Successful! ntfy is online"
|
|
url_username: "{{ ntfy_web_user }}"
|
|
url_password: "{{ ntfy_web_pass }}"
|
|
force_basic_auth: true
|
|
status_code: 200
|
|
register: ntfy_health_check
|
|
until: ntfy_health_check.status == 200
|
|
retries: 10
|
|
delay: 3
|