change: notification body

This commit is contained in:
2026-07-14 19:40:26 +00:00
parent 52eaeaae93
commit eccd940727

View File

@@ -391,6 +391,10 @@
vars: vars:
master: "{{ groups['opnsense_master'][0] }}" master: "{{ groups['opnsense_master'][0] }}"
backup: "{{ groups['opnsense_backup'][0] }}" backup: "{{ groups['opnsense_backup'][0] }}"
m: "{{ hostvars[master] }}"
b: "{{ hostvars[backup] }}"
same_operation: "{{ m.firmware_status == b.firmware_status }}"
ansible.builtin.uri: ansible.builtin.uri:
url: "{{ ntfy_url }}/{{ ntfy_topic }}" url: "{{ ntfy_url }}/{{ ntfy_topic }}"
method: POST method: POST
@@ -398,13 +402,32 @@
password: "{{ lookup('env', 'NTFY_PASSWORD') }}" password: "{{ lookup('env', 'NTFY_PASSWORD') }}"
force_basic_auth: true force_basic_auth: true
body: | body: |
OPNsense HA cluster {{ firmware_action }} completed successfully. {%- if same_operation -%}
{% for host in [master, backup] %} {%- if m.skip_update | default(false) -%}
{% set h = hostvars[host] %} Both nodes already on {{ m.firmware_current_version }}, no action taken.
{{ h.main_role }} ({{ host }}): {% if h.skip_update %}already on {{ h.firmware_current_version }}, skipped{% else %}{{ h.firmware_current_version }} → {{ h.firmware_target_value }}{% endif %}{{ "\n" if not loop.last else "" }} {%- else -%}
{% endfor %} OPNsense cluster: {{ m.firmware_current_version }} → {{ m.firmware_target_value }} ({{ m.firmware_status }})
{%- endif -%}
{%- else -%}
{%- if m.skip_update | default(false) -%}
MASTER ({{ master }}): already on {{ m.firmware_current_version }}, no action taken.
{%- else -%}
MASTER ({{ master }}): {{ m.firmware_current_version }} → {{ m.firmware_target_value }} ({{ m.firmware_status }})
{%- endif %}
{{ '\n' }}
{%- if b.skip_update | default(false) -%}
BACKUP ({{ backup }}): already on {{ b.firmware_current_version }}, no action taken.
{%- else -%}
BACKUP ({{ backup }}): {{ b.firmware_current_version }} → {{ b.firmware_target_value }} ({{ b.firmware_status }})
{%- endif -%}
{%- endif -%}
headers: headers:
Title: "OPNsense {{ firmware_action }} completed" Title: |
Priority: "default" {%- if m.skip_update | default(false) and b.skip_update | default(false) -%}
Tags: "white_check_mark" OPNsense cluster — no {{ _action }} available
{%- else -%}
OPNsense cluster {{ _action }} completed
{%- endif -%}
Priority: "{{ 'min' if (m.skip_update | default(false) and b.skip_update | default(false)) else 'default' }}"
Tags: "{{ 'information_source' if (m.skip_update | default(false) and b.skip_update | default(false)) else 'white_check_mark' }}"
when: ntfy_url is defined when: ntfy_url is defined