diff --git a/roles/pfsense_upgrade/tasks/backup_webhook.yml b/roles/pfsense_upgrade/tasks/backup_webhook.yml new file mode 100644 index 0000000..37c34cb --- /dev/null +++ b/roles/pfsense_upgrade/tasks/backup_webhook.yml @@ -0,0 +1,23 @@ +- name: Capture current config.xml for backup + ansible.builtin.raw: | + cat /conf/config.xml + register: _config_xml + when: perform_upgrade | bool + +- name: Send config to webhook (if webhook URL provided) + uri: + url: "{{ n8n_webhook_url }}" + method: POST + body: | + { + "client_id": "{{ client_id }}", + "hostname": "{{ inventory_hostname }}", + "timestamp": "{{ ansible_date_time.iso8601 }}", + "config_xml": "{{ _config_xml.stdout | b64encode }}" + } + body_format: json + when: + - perform_upgrade | bool + - n8n_webhook_url is defined + - n8n_webhook_url | length > 0 + delegate_to: localhost \ No newline at end of file