Container migration playbook
If you need to migrate containers and data between hosts, do the following:
- Set the
configure_xxxxx
variable for the target host totrue
to prepare the target host. - Set the
start_xxxxx
variable for the target host tofalse
because we don't want to start any services before copying data. - Run Ansible. With the above configuration, it will prepare the target host without starting any service.
- Set the
stop_xxxxx
variable for the source host totrue
to stop the service we're migrating. - Run Ansible.
- Copy data from the source host to the target host. You can use
scripts/migrate-container-data.sh
script to transfer data from one host to another. - Remove the
start_xxxxx
from the target host configuration because it defaults to theconfigure_xxxxx
value, which is set totrue
. - Run Ansible.
- Remove the
stop_xxxxx
variable from the source host configuration. - Remove the
configure_xxxxx
variable from the source host configuration. - Run Ansible.
- Commit the changes in the repository.
Data migration examples
These examples assume that the current working directory is the root of this repository.
To migrate one directory from one host to another:
scripts/migrate-container-data.sh "user@source.host" "/source/directory" "user2@target.host" "/destination"