You've already forked proxmox-backup
162 lines
10 KiB
Markdown
162 lines
10 KiB
Markdown
proxmox-backup
|
|
==============
|
|
|
|
This ansible role :
|
|
- installs proxmox-backup-client on host
|
|
- copy a custom backup script
|
|
|
|
It has been successfully tested on :
|
|
- Debian "Bullseye" 11
|
|
- Debian "Bookworm" 12
|
|
|
|
Custom backup script
|
|
--------------------
|
|
|
|
The custom script :
|
|
- copy & compress the entire system
|
|
- extract informations from your system (packages list, crontab, partition table, etc)
|
|
- can dump MySQL database(s), including routines/events/triggers
|
|
- can dump MariaDB database(s), including routines/events/triggers
|
|
- can dump PostgreSQL database(s)
|
|
- can dump Gitea data
|
|
- can dump sshportal data
|
|
|
|
All files are then send it to a custom Proxmox Backup Server.
|
|
|
|
Role variables
|
|
---------------
|
|
|
|
| Variable | Type | Choices | Default | Comment |
|
|
|---------------------------|---------|------------------|--------------------------------------------------------------------------------------|-------------------|
|
|
| pbs_debian_release_name | string | | bookworm | |
|
|
| pbs_repo_key | string | | https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg | |
|
|
| pbs_repo_no_subscription | string | | deb http://download.proxmox.com/debian/pbs-client {{ pbs_debian_release_name }} main | |
|
|
| pbs_user | string | | | mandatory |
|
|
| pbs_server | string | | | mandatory |
|
|
| pbs_datastore | string | | | mandatory |
|
|
| pbs_fingerprint | string | | | mandatory |
|
|
| pbs_password | string | | | mandatory |
|
|
| backup_host_id | string | | | |
|
|
| backup_dir | string | | | mandatory |
|
|
| backup_local_retention | string | | | mandatory |
|
|
| backup_path_include | list | | | |
|
|
| backup_path_exclude | list | | | |
|
|
| backup_mysql_enabled | boolean | | | uses mysqldump with routines/events/triggers |
|
|
| backup_mysql_host | string | | | optional |
|
|
| backup_mysql_user | string | | | optional |
|
|
| backup_mysql_password | string | | | optional |
|
|
| backup_mysql_docker_enabled | boolean | | false | run mysql in docker |
|
|
| backup_mysql_docker_container | string | | | required if docker enabled |
|
|
| backup_mariadb_enabled | boolean | | | uses mariadb-dump with routines/events/triggers |
|
|
| backup_mariadb_host | string | | | optional |
|
|
| backup_mariadb_user | string | | | optional |
|
|
| backup_mariadb_password | string | | | optional |
|
|
| backup_mariadb_docker_enabled | boolean | | false | run mariadb in docker |
|
|
| backup_mariadb_docker_container | string | | | required if docker enabled |
|
|
| backup_pgsql_enabled | boolean | | | |
|
|
| backup_pg_host | string | | | optional |
|
|
| backup_pg_user | string | | | optional |
|
|
| backup_pg_password | string | | | optional |
|
|
| backup_pg_docker_enabled | boolean | | false | run postgresql in docker |
|
|
| backup_pg_docker_container| string | | | required if docker enabled |
|
|
| backup_gitea_enabled | boolean | | false | enable gitea dump |
|
|
| backup_gitea_config | string | | /data/gitea/conf/app.ini | gitea app.ini path |
|
|
| backup_gitea_docker_enabled | boolean | | false | run gitea dump in docker |
|
|
| backup_gitea_docker_container | string | | | required if docker enabled |
|
|
| backup_gitea_docker_workdir | string | | /backup | container workdir where gitea dump is generated |
|
|
| backup_gitea_docker_host_temp_dir | string | | {{ backup_dir }}/temp | host temp dir mounted in container |
|
|
| backup_sshportal_enabled | boolean | | false | enable sshportal backup |
|
|
| backup_sshportal_db_path | string | | /var/lib/docker/volumes/sshportal__var_lib_sshportal/_data/sshportal.db | sqlite db path |
|
|
| backup_sshportal_ssh_host | string | | localhost | ssh host |
|
|
| backup_sshportal_ssh_port | string | | 2222 | ssh port |
|
|
| backup_sshportal_ssh_user | string | | admin | ssh user |
|
|
| backup_sshportal_ssh_key | string | | /opt/docker-compose/sshportal/ed25519_sshportal_admin | ssh private key |
|
|
| backup_cron_minute | int | | | |
|
|
| backup_cron_hour | int | | | |
|
|
|
|
Dependencies
|
|
------------
|
|
|
|
None.
|
|
|
|
Example Playbook
|
|
----------------
|
|
|
|
```
|
|
- hosts: example
|
|
ignore_errors: "{{ ansible_check_mode }}" # ignore errors only in check mode !
|
|
|
|
roles:
|
|
- { role: proxmox-backup, tags: ['proxmox-backup'] }
|
|
```
|
|
|
|
Example variables
|
|
-----------------
|
|
|
|
```
|
|
---
|
|
pbs_user: 'my_user'
|
|
pbs_server: 'my_pbs_server:8007'
|
|
pbs_datastore: 'my_datastore'
|
|
pbs_fingerprint: 'aa:bb:cc:dd:ee:ff:'
|
|
pbs_password: 'my_password'
|
|
|
|
backup_dir: /backup
|
|
backup_local_retention: 2
|
|
|
|
backup_path_include:
|
|
- /etc
|
|
- /var/www
|
|
|
|
backup_path_exclude:
|
|
- /var/backups
|
|
- *.log
|
|
- cache/
|
|
|
|
backup_mysql_enabled: true
|
|
backup_mysql_host: ''
|
|
backup_mysql_user: ''
|
|
backup_mysql_password: ''
|
|
backup_mysql_docker_enabled: false
|
|
backup_mysql_docker_container: ''
|
|
|
|
backup_mariadb_enabled: true
|
|
backup_mariadb_host: ''
|
|
backup_mariadb_user: ''
|
|
backup_mariadb_password: ''
|
|
backup_mariadb_docker_enabled: true
|
|
backup_mariadb_docker_container: 'mariadb'
|
|
|
|
backup_pgsql_enabled: true
|
|
backup_pg_host: ''
|
|
backup_pg_user: ''
|
|
backup_pg_password: ''
|
|
backup_pg_docker_enabled: false
|
|
backup_pg_docker_container: ''
|
|
|
|
backup_gitea_enabled: true
|
|
backup_gitea_config: '/data/gitea/conf/app.ini'
|
|
backup_gitea_docker_enabled: true
|
|
backup_gitea_docker_container: 'gitea'
|
|
|
|
backup_sshportal_enabled: true
|
|
backup_sshportal_db_path: '/var/lib/docker/volumes/sshportal__var_lib_sshportal/_data/sshportal.db'
|
|
backup_sshportal_ssh_host: 'localhost'
|
|
backup_sshportal_ssh_port: '2222'
|
|
backup_sshportal_ssh_user: 'admin'
|
|
backup_sshportal_ssh_key: '/opt/docker-compose/sshportal/ed25519_sshportal_admin'
|
|
|
|
backup_cron_minute: 30
|
|
backup_cron_hour: 5
|
|
```
|
|
|
|
License
|
|
-------
|
|
|
|
MIT Modern
|
|
|
|
Author Information
|
|
------------------
|
|
|
|
Written by Ludovic Cartier <ludovic.cartier@brainsys.io>
|