change: notification body
This commit is contained in:
@@ -391,6 +391,10 @@
|
||||
vars:
|
||||
master: "{{ groups['opnsense_master'][0] }}"
|
||||
backup: "{{ groups['opnsense_backup'][0] }}"
|
||||
m: "{{ hostvars[master] }}"
|
||||
b: "{{ hostvars[backup] }}"
|
||||
same_operation: "{{ m.firmware_status == b.firmware_status }}"
|
||||
|
||||
ansible.builtin.uri:
|
||||
url: "{{ ntfy_url }}/{{ ntfy_topic }}"
|
||||
method: POST
|
||||
@@ -398,13 +402,32 @@
|
||||
password: "{{ lookup('env', 'NTFY_PASSWORD') }}"
|
||||
force_basic_auth: true
|
||||
body: |
|
||||
OPNsense HA cluster {{ firmware_action }} completed successfully.
|
||||
{% for host in [master, backup] %}
|
||||
{% set h = hostvars[host] %}
|
||||
{{ 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 "" }}
|
||||
{% endfor %}
|
||||
{%- if same_operation -%}
|
||||
{%- if m.skip_update | default(false) -%}
|
||||
Both nodes already on {{ m.firmware_current_version }}, no action taken.
|
||||
{%- else -%}
|
||||
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:
|
||||
Title: "OPNsense {{ firmware_action }} completed"
|
||||
Priority: "default"
|
||||
Tags: "white_check_mark"
|
||||
Title: |
|
||||
{%- if m.skip_update | default(false) and b.skip_update | default(false) -%}
|
||||
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
|
||||
Reference in New Issue
Block a user