This role will install and configure backupninja based on my own needs. It uses a temporal folder to create a full backup of a list of directories and encrypt it using GPG. My recommendation is to use it to backup config files and databases to do a quick disaster recovery plan in small servers and PCs.
This role has been tested against Debian, Ubuntu and Centos in their last versions but it may work in other systems too.
To use this role you should have installed:
- tar, gzip
Variables | Description | Type |
---|---|---|
ninja_when | Time Scheduler for Backupninja | String |
ninja_backupname | Name of a temporal TAR file | String |
ninja_backupname_def | Name of the definitive TAR file | String |
ninja_backupdir | Path with the location of the temporal TAR file | String |
ninja_backupdir_def | Path with the location of the definitive TAR file | String |
ninja_compress | Method to compress the backups done with Backupninja | String |
ninja_includes | List of folders to be saved by the backup | String |
ninja_excludes | List of folder to be excluded by default | String |
ninja_mysql_enabled | Boolean to enable the backup for MySQL databases | Boolean |
ninja_mysql_hotcopy | To use hotcopy in MySQL or not | String |
ninja_mysql_sqldump | To use sqldump as method to backup MySQL | String |
ninja_mysql_compress | To compress the MySQL dump or not | String |
ninja_mysql_dbhost | The host where the database is stored | String |
ninja_mysql_backupdir | Path with the location of the MySQL backup | String |
ninja_mysql_databases | List of databases to be saved in the backup. "all" means all databases | String |
ninja_mysql_username | The user to backup the MySQL databases | String |
ninja_mysql_password | The password of the user to connect to MySQL server | String |
ninja_retention_period | Number of days the backup should be saved | String |
ninja_gpg_encryption_enabled | Boolean to enable the use of GPG cypher in the final step | Boolean |
ninja_gpg_user | GPG user to encrypt the final backup (username@domain) | String |
This role has no dependencies
---
- name: Deploy backupninja to backup a MySQL and some folders in Debian
hosts: my-own-server
become: true
vars:
- ninja_backupname: "files"
- ninja_backupname_def: "my-own-server"
- ninja_backupdir: "/tmp/backups"
- ninja_backupdir_def: "/var/lib/backups"
- ninja_includes: "/var/www/nextcloud"
- ninja_mysql_backupdir: "/tmp/backups"
roles:
- role: backupninja
---
- name: Deploy backupninja to backup a MySQL and some folders in CentOS
hosts: my-own-server
become: true
vars:
- ninja_backupname: "files"
- ninja_backupname_def: "my-own-server"
- ninja_backupdir: "/tmp/backups"
- ninja_backupdir_def: "/var/lib/backups"
- ninja_includes: "/var/www/nextcloud"
- ninja_mysql_username: "bckadmin"
- ninja_mysql_userpassword: "mysuperhardtorememberpassword"
- ninja_mysql_backupdir: "/tmp/backups"
roles:
- role: backupninja
---
- name: Deploy backupninja to do an encrypted backup
hosts: my-own-server
become: true
vars:
- ninja_backupname: "files"
- ninja_backupname_def: "my-own-server"
- ninja_backupdir: "/tmp/backups"
- ninja_backupdir_def: "/var/lib/backups"
- ninja_includes: "/var/www/nextcloud"
- ninja_mysql_username: "bckadmin"
- ninja_mysql_userpassword: "mysuperhardtorememberpassword"
- ninja_mysql_backupdir: "/tmp/backups"
- ninja_gpg_encryption_enabled: true
- ninja_gpg_user: "[email protected]"
roles:
- role: backupninja
GPLv3
Tangelov - https://tangelov.me