Skip to content

Nuface Blog

้šจๆ„้šจๆ‰‹่จ˜ Casual Notes

Menu
  • Home
  • About
  • Services
  • Blog
  • Contact
  • Privacy Policy
  • Login
Menu

Proxmox Backup Server Automation with N8N and Ansible

Posted on 2025-11-032025-11-03 by Rico

๐Ÿ”ฐ 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

FunctionEndpointDescription
Start Backup/api2/json/admin/datastore/<store>/backupTrigger VM / CT backup
Run Verification/api2/json/admin/datastore/<store>/verifyStart Verify Job
Execute Sync/api2/json/admin/datastore/<store>/syncTrigger cross-site sync
Restore Data/api2/json/admin/datastore/<store>/restoreStart restore operation
Check Task Status/api2/json/nodes/<node>/tasksQuery 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

TaskToolFunction
Backup SchedulingN8N SchedulerRun daily backups
Task ReportingN8N HTTP + SlackNotify success/failure
Cross-Site SyncAnsible PlaybookAutomate DR replication
VerificationAnsible + PBS VerifyPeriodic integrity check
Fault RecoveryN8N โ†’ Ansible TriggerExecute restore scripts
ReportingN8N Email NodeSend weekly PDF summaries

โ˜๏ธ 6. Best Practices and Security

AreaRecommendation
API SecurityUse PBS API tokens with IP restrictions
TLS EncryptionEnforce HTTPS / TLS 1.2+ for all communications
Credential ManagementStore secrets in Ansible Vault
N8N WebhooksUse tokenized, signed webhooks for verification
Error HandlingImplement โ€œError Workflowโ€ branches in N8N
Multi-Site ConnectivityPrefer 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.

Recent Posts

  • Postfix + Letโ€™s Encrypt + BIND9 + DANE Fully Automated TLSA Update Guide
  • Postfix + Letโ€™s Encrypt + BIND9 + DANE TLSA ๆŒ‡็ด‹่‡ชๅ‹•ๆ›ดๆ–ฐๅฎŒๆ•ดๆ•™ๅญธ
  • Deploying DANE in Postfix
  • ๅฆ‚ไฝ•ๅœจ Postfix ไธญ้ƒจ็ฝฒ DANE
  • DANE: DNSSEC-Based TLS Protection

Recent Comments

  1. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on High Availability Architecture, Failover, GeoDNS, Monitoring, and Email Abuse Automation (SOAR)
  2. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on MariaDB + PostfixAdmin: The Core of Virtual Domain & Mailbox Management
  3. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Daily Operations, Monitoring, and Performance Tuning for an Enterprise Mail System
  4. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Final Chapter: Complete Troubleshooting Guide & Frequently Asked Questions (FAQ)
  5. Building a Complete Enterprise-Grade Mail System (Overview) - Nuface Blog on Network Architecture, DNS Configuration, TLS Design, and Postfix/Dovecot SNI Explained

Archives

  • December 2025
  • November 2025
  • October 2025

Categories

  • AI
  • Apache
  • Cybersecurity
  • Database
  • DNS
  • Docker
  • Fail2Ban
  • FileSystem
  • Firewall
  • Linux
  • LLM
  • Mail
  • N8N
  • OpenLdap
  • OPNsense
  • PHP
  • QoS
  • Samba
  • Switch
  • Virtualization
  • VPN
  • WordPress
© 2025 Nuface Blog | Powered by Superbs Personal Blog theme