Automate and secure your virtual machines with Ansible Proxmox backup efficiently. Our Proxmox Support team is ready to assist you. 

Automate and Secure Proxmox Backups with Ansible

Automating Proxmox backups with Ansible ensures your virtual machines and configurations are protected consistently. It saves time, reduces errors, and allows scheduled backups across multiple servers without manual effort.

Automating Proxmox Backups with Ansible

Automate and Secure Proxmox Backups with Ansible

Automating backups in Proxmox with Ansible ensures your virtual machines are protected without manual effort. This approach is reliable, consistent, and scalable for small and large environments alike.


Setting up proper configuration also helps in troubleshooting issues with Proxmox remote access, ensuring that automated tasks run smoothly even when managing VMs from different locations.

Install Ansible

Set up Ansible on a control machine. This machine will manage backup tasks across all your Proxmox servers by executing playbooks.

Configure Your Inventory

Create an inventory file to define your Proxmox hosts. This file lists all servers that Ansible will manage.

Example Inventory

[proxmox_servers]
pve1.example.com
pve2.example.com
Create an Ansible Playbook

Write a playbook in YAML format to define backup tasks. Use API tokens for security instead of passwords.

Example Playbook

---
- name: Perform Proxmox Backups
hosts: proxmox_servers
tasks:
- name: Create VM backup
proxmox_kvm_backup
node: "pve1"
vmid: 100
storage: "backup"
api_user: "ansible@pve"
api_token_id: "ansible_token"
api_token_secret: "your_api_token_secret"
compress: true
rotation: 3

This setup is also compatible with specialized configurations such as Proxmox ARM64 Guest Setup, allowing automated backups for ARM64 virtual machines without extra adjustments.

Run the Playbook

Execute the playbook from the control machine using:

ansible-playbook -i inventory.ini backup_playbook.yaml

This runs the defined backup tasks on all servers in your inventory.

Automate and Schedule

To ensure backups run regularly, integrate the playbook with a scheduling system.

Options for Automation

  • Cron Jobs: Schedule recurring execution on the control machine
  • Ansible Tower or AWX: Manage schedules, monitor backups, and get reports

Automate your Proxmox backups effortlessly today

Chat animation


Proxmox Backup Role with Ansible

The proxmox_backup Ansible role simplifies backing up your Proxmox configuration. It wraps the prox_config_backup.sh script from GitHub, providing customizable options for backup directories, temporary storage, logging, and scheduling. This approach ensures consistent, reliable, and automated configuration backups with minimal effort.

Requirements
  • Ansible version 2.7 or higher
  • Access to the Proxmox host
Key Role Variables
Variable Default Description
proxmox_backup_script_url GitHub URL Source to download the backup script
proxmox_backup_wrapper_script_path /usr/local/sbin/prox_config_backup_wrapper.sh Path for the wrapper script
proxmox_backup_temp_dir /var/tmp Temporary folder used during backup
proxmox_backup_log_file {{ proxmox_backup_log_dir }}/pve-backup.log Path for the log file
proxmox_backup_script_path /usr/local/sbin/prox_config_backup.sh Path of the script on Proxmox
proxmox_backup_dir /mnt/backups/proxmox Directory to store backups
proxmox_backup_log_dir /var/log/pve-backup Directory for backup logs
proxmox_backup_cron_configure false Enable or disable automatic cron scheduling
Cronjob Configuration

You can schedule backups automatically by enabling proxmox_backup_cron_configure. Control the timing using these optional variables:

  • proxmox_backup_cron_minute
  • proxmox_backup_cron_hour
  • proxmox_backup_cron_day
  • proxmox_backup_cron_month
  • proxmox_backup_cron_weekday
  • proxmox_backup_cron_special_time

This ensures backups run on your preferred schedule without manual intervention.

Why Use This Role

  • Automates Proxmox configuration backups
  • Provides flexible storage and logging options
  • Supports automated backup schedules
  • Reduces errors from manual backup processes

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

Using Ansible Proxmox backup simplifies and secures the process of protecting your virtual machines and configurations. It ensures consistent, automated backups, reduces manual errors, and allows easy scheduling across multiple servers. Implementing this approach gives administrators a reliable and efficient way to safeguard their Proxmox environment.