New backup process
This commit is contained in:
23
roles/pfsense_upgrade/tasks/backup_webhook.yml
Normal file
23
roles/pfsense_upgrade/tasks/backup_webhook.yml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user