Application Restoration
This Playbook is used to restore application backups from our backup playbook. This includes restoring different application types, host direct
, Docker
and kubernetes
.
- job tag
application
Important
The use of this playbook requires that --limit
be specified as this is the host that the restoration will occur to.
Playbook AWX / Ansible Automation Platform Template Import
This playbook includes the AWX feature where it imports the playbook as job templates in to AWX / Ansible Automation Platform. The following job templates that will be created:
- Restore/Application Restore an Application
Play workflow
-
copy backup file to remote host
-
decrypt backup file
-
Restore path(s) to the container
-
Restore database(s)
-
remove backup file from the host.
Info
On error during any stage of the workflow, prior to the play stopping all files related to the workflow, included any created (i.e. extracting contents of archive) will be removed so there are no traces on the remote host.
Variables
This playbook requires variables be set which instruct what is to occur. The parent key for the variables is nfc_pb_restore
which is a yaml object that when completed determins what backup(s) to use and how to restore the backup(s).
Restoration Yaml Object.
nfc_pb_restore:
restore_directory_backups: # Mandatory, String. Name of backup file to restore without file extension. .enc.tar is assumed
applications: [] # Mandatory, List of Dict. The applications to restore
Restoring an Application
To restore an application, an application list item must be added to nfc_pb_restore
at path nfc_pb_restore.applications
Application list items are broken down into three different types: application
, docker
and kubernetes
. Each type has it's own requirements.
Tip
Different Application type backups can be restored to a different application type. This allows a migration for example where the deployment of said application was originally with docker, that now is being deployed with kubernetes.
- name: vaultwarden # Mandatory, String. Name of the Application
file_restore: # Mandatory, String. Name of file without extension to restore
type: kube # Mandatory, string. Kubernetes container engine
path: [] # Mandatory*, List of Dict. Required to restore files to path
pod: vaultwarden-0
namespace: vaultwarden
databases: # Mandatory*, dict, choice=mariadb|mysql. Only required if database restoration to be done.
mariadb: [] # Mandatory, string. MariaDB/MySQL databases to restore
mysql: [] # Mandatory, string. MariaDB/MySQL databases to restore
postgres: [] # Mandatory, string. Postgres databases to restore
To be developed
To Be Developed
Tip
If you wish to restore backups for multiple applications this is possible by adding additional application list items.
Files
Restoring files requires that there be a path list item added at path nfc_pb_restore.applications[x].path
- name: data # Mandatory. String. sub-directory name inside the archive
path: /data # Mandatory, String. Path within the container to restore to
Database
To restore a database a database list item must be added at path nfc_pb_restore.applications[x].databases.<database_type>
Tip
For both MariaDB and MySQL the same code is executed and each name only exists for ease of reading. The reality is that either mariadb
or MySQL
keys are interchangeable.
- name: vaultwarden # Mandatory, String. Backup database filename.
host: # Database connection host
name: mariadb-galera.mariadb.svc # Mandatory. String. DNS or IP of database host to connect
port: # Optional, Integer. port of database host to connect to.
socket: # Optional. String. Path to the MySQL socket to use for connection.
# If used host.name is not required
destination: vaultwarden # Optional, string. default={use name key} database name to restore to.
- name: vaultwarden # Mandatory, String. Backup database filename.
host: # Database connection host
name: main-postgresql-ha-pgpool.postgres.svc # Mandatory. String. DNS or IP of database host to connect
port: # Optional, Integer. port of database host to connect to.
socket: # Optional. String. Path to the MySQL socket to use for connection.
# If used host.name is not required
destination: vaultwarden # Optional, string. default={use name key} database name to restore to.
About:
This page forms part of our Project Ansible Playbooks.
Page Metadata
Version: ToDo: place files short git commit hereDate Created: 2024-01-13
Date Edited: 2024-01-21
Contribution:
Would You like to contribute to our Ansible Playbooks project? You can assist in the following ways:
- Edit This Page If there is a mistake or a way you can improve it.
- Add a Page to the Manual if you would like to add an item to our manual
- Raise an Issue if there is something about this page you would like to improve, and git is unfamiliar to you.
ToDo: Add the page list of contributors