π° Introduction
In distributed and hybrid cloud infrastructures,
backup automation is no longer optional β itβs a critical requirement.
Proxmox Backup Server (PBS) provides a complete RESTful API and powerful CLI tools,
making it an ideal platform for integration with open-source automation frameworks such as N8N and Ansible.
By combining these two tools, organizations can build a self-operating, self-verifying, and self-healing backup ecosystem,
capable of detecting issues, reporting them in real time, and executing automated recovery actions.
π§© 1. Architecture Overview
Automated Backup Framework
βββββββββββββββββββββββββββββββ
β Proxmox VE Cluster β
β (Production VMs / CTs) β
ββββββββββββββββ¬βββββββββββββββ
β Backup API Trigger
βΌ
βββββββββββββββββββββββββββββββ
β Proxmox Backup Server (PBS) β
β - REST API Endpoint β
β - Sync / Verify / Restore β
ββββββββββββββββ¬βββββββββββββββ
β
βββββββββ΄βββββββββββββββββββββββββ
β β
ββββββββββββββββ ββββββββββββββββββ
β N8N Flow β β Ansible Play β
β API Orchestration β β Automated Exec β
β Monitoring / Alerts β β (Sync / Verify)β
ββββββββββββββββ ββββββββββββββββββ
β β
βΌ βΌ
Slack / Email Multi-Site PBS / DR Restore
βοΈ 2. Integrating PBS with N8N
1οΈβ£ Why N8N
N8N is an open-source automation platform that connects APIs, webhooks, and external triggers.
Itβs ideal for:
- Scheduling recurring backups
- Monitoring backup results
- Sending alerts and reports
- Triggering recovery workflows automatically
2οΈβ£ Key PBS API Endpoints
| Function | Endpoint | Description |
|---|---|---|
| Start Backup | /api2/json/admin/datastore/<store>/backup | Trigger VM / CT backup |
| Run Verification | /api2/json/admin/datastore/<store>/verify | Start Verify Job |
| Execute Sync | /api2/json/admin/datastore/<store>/sync | Trigger cross-site sync |
| Restore Data | /api2/json/admin/datastore/<store>/restore | Start restore operation |
| Check Task Status | /api2/json/nodes/<node>/tasks | Query task progress and result |
3οΈβ£ Example N8N Workflow
Logic Flow:
1οΈβ£ Schedule trigger (e.g., every night at 23:00)
2οΈβ£ Call PBS backup API
3οΈβ£ Query job status
4οΈβ£ If failed β send Slack/Email notification
5οΈβ£ If failed repeatedly β trigger Ansible recovery playbook
Simplified Workflow:
[Schedule Trigger] β [HTTP Request: PBS Backup API]
β [HTTP Request: PBS Task Status]
β [IF (Status != OK)] β [Slack Notification]
β [Execute Command Node: ansible-playbook recover.yml]
π§ 3. Automating with Ansible
1οΈβ£ Why Ansible
Ansible uses an agentless, SSH-based architecture β ideal for managing PBS clusters and DR workflows.
It enables:
- Batch management across multiple PBS nodes
- Automatic creation of Sync / Verify jobs
- Autonomous failover and restore operations
2οΈβ£ Example Playbook β Automated Sync and Verify
- name: PBS Sync Job Automation
hosts: pbs-nodes
tasks:
- name: Trigger Sync Job
command: >
proxmox-backup-manager sync-job run --id sync-to-dr
- name: Run Verify Job
command: >
proxmox-backup-manager verify start --store pbs-remote --all
- name: Send Log to N8N
command: >
curl -X POST -H "Content-Type: application/json"
-d '{"status":"completed","job":"sync-to-dr"}'
https://n8n-server/webhook/pbs-report
3οΈβ£ Example Playbook β Automated Restore (DR Mode)
- name: Restore Critical VM from DR PBS
hosts: dr-pbs
tasks:
- name: Trigger Restore API
uri:
url: "https://dr-pbs:8007/api2/json/admin/datastore/pbs-remote/restore"
method: POST
body_format: form-urlencoded
body:
backup-type: "vm"
backup-id: "vm-101"
target: "/mnt/vmrestore"
validate_certs: no
user: "api-user@pbs"
password: "{{ pbs_token }}"
This can be triggered automatically by N8N when a primary site failure is detected.
π§© 4. Automated Monitoring and Notifications
1οΈβ£ Slack / Email Reporting
Integrate N8N with Slack, Gmail, or SMTP to send real-time alerts:
[IF task failed] β [Slack Node]
Message: "Backup Job Failed on {{node}} at {{time}}"
2οΈβ£ Prometheus + N8N Integration
Use N8N to periodically poll PBS API metrics and push to Prometheus:
- Backup success rate
- Sync latency
- Average task execution time
Visualize via Grafana dashboards for backup health and SLA tracking.
π 5. Full Automation Workflow Example
| Task | Tool | Function |
|---|---|---|
| Backup Scheduling | N8N Scheduler | Run daily backups |
| Task Reporting | N8N HTTP + Slack | Notify success/failure |
| Cross-Site Sync | Ansible Playbook | Automate DR replication |
| Verification | Ansible + PBS Verify | Periodic integrity check |
| Fault Recovery | N8N β Ansible Trigger | Execute restore scripts |
| Reporting | N8N Email Node | Send weekly PDF summaries |
βοΈ 6. Best Practices and Security
| Area | Recommendation |
|---|---|
| API Security | Use PBS API tokens with IP restrictions |
| TLS Encryption | Enforce HTTPS / TLS 1.2+ for all communications |
| Credential Management | Store secrets in Ansible Vault |
| N8N Webhooks | Use tokenized, signed webhooks for verification |
| Error Handling | Implement βError Workflowβ branches in N8N |
| Multi-Site Connectivity | Prefer pull-based sync from remote PBS to minimize exposure |
β Conclusion
By integrating Proxmox Backup Server with N8N and Ansible,
organizations can build a fully automated, observable, and self-healing backup system.
This approach delivers:
- Automated backup and replication
- Real-time alerting and event response
- Hands-free failover and restore automation
- Seamless hybrid integration with Ceph, S3, or remote PBS nodes
Resulting in a truly modern data protection model:
Automated Β· Intelligent Β· Zero-Touch Backup Resilience.
π¬ Coming next:
βProxmox AI Operations β Using LLMs for Predictive Maintenance and Autonomous Backup Decisionsβ
exploring how AI models can enhance anomaly detection, self-optimization, and predictive DR planning within the Proxmox ecosystem.