The ability to backup and restore your system(s) has been integrated into the Tower setup playbook. Refer to Backup and Restore for Clustered Environments for additional considerations.
When restoring, be sure to restore to the same version from which it was backed up. However, you should always use the most recent minor version of a release to backup and/or restore your Tower installation version. For example, if the current version of Tower that you are on is 3.0.0, 3.0.1, or 3.0.2, use only the 3.0.2 installer.
Also, backup and restore will only work on PostgreSQL versions supported by your current Ansible Tower version. For more information, see Requirements in the Ansible Tower Installation and Reference Guide.
The Tower setup playbook is invoked as
setup.sh from the path where you unpacked the Tower installer tarball. It uses the same inventory file used by the install playbook. The setup script takes the following arguments for backing up and restoring:
-bPerform a database backup rather than an installation.
-rPerform a database restore rather than an installation.
As the root user, call
setup.sh with the appropriate parameters and Tower backup or restored as configured.
root@localhost:~# ./setup.sh -b
root@localhost:~# ./setup.sh -r
Backup files will be created on the same path that setup.sh script exists. It can be changed by specifying the following
root@localhost:~# ./setup.sh -e 'backup_dest=/path/to/backup_dir/' -b
A default restore path is used unless
EXTRA_VARS are provided with a non-default path, as shown in the example below:
root@localhost:~# ./setup.sh -e 'restore_backup_file=/path/to/nondefault/backup.tar.gz' -r
Optionally, you can override the inventory file used by passing it as an argument to the setup script:
setup.sh -i <inventory file>
In addition to the
install.yml file included with your
setup.sh setup playbook, there are also
restore.yml files for your backup and restoration needs.
These playbooks serve two functions–backup and restore.
When restoring your system, Tower checks to see that the backup file exists before beginning the restoration. If the backup file is not available, your restoration will fail.
Ensure your Tower host(s) are properly set up with SSH keys or user/pass variables in the hosts file, and that the user has sudo access.
sudoaccess, depending on how credentials were setup. On remote systems, you may need different credentials to grant you access to the remote system you are trying to backup or restore.
setup.shto do a restore from the default restore file path,
-ris still required in order to do the restore, but it no longer accepts an argument. If a non-default restore file path is needed, the user must provide this as an extra var (
root@localhost:~# ./setup.sh -e 'restore_backup_file=/path/to/nondefault/backup.tar.gz' -r).
setup.shinstaller, the restore playbook will automatically locate the restore files. In this case, you do not need to use the
restore_backup_fileextra var to specify the location of the backup file.
The procedure for backup and restore for a clustered environment is similar to a single install, except with some considerations described in this section.
When restoring to an existing cluster, the restore contains:
When restoring a backup to a separate instance or cluster, host-specific configuration (including manual projects, job output, and custom settings under
/etc/tower) is not restored to any hosts in the new environment.
The restore process will not alter instance groups present before the restore (neither will it introduce any new instance groups). Restored Tower resources that were associated to instance groups will likely need to be reassigned to instance groups present on the new Tower cluster.