๐ฐ 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.