Skip to content

Commit 79bbb68

Browse files
author
petergmurphy
committed
(PE-40371) Add migration plan for standard architecture
This commit adds a migration plan which utilises backup, install and restore plans to install and restore PE on new infrastructure with a standard architecture. This commit also introduces a new 'migration' option for backup and restore plans, enabling a new migration plan.
1 parent 80d18de commit 79bbb68

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

plans/backup.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Peadm::SingleTargetSpec $targets,
1313

1414
# backup type determines the backup options
15-
Enum['recovery', 'custom'] $backup_type = 'recovery',
15+
Enum['recovery', 'custom', 'migration'] $backup_type = 'recovery',
1616

1717
# Which data to backup
1818
Peadm::Recovery_opts $backup = {},

plans/migrate.pp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
plan peadm::migrate (
2+
# This plan should be run on the primary server
3+
Peadm::SingleTargetSpec $old_primary_host,
4+
Peadm::SingleTargetSpec $new_primary_host,
5+
) {
6+
peadm::assert_supported_bolt_version()
7+
8+
$backup_file = run_plan('peadm::backup', $old_primary_host, {
9+
backup_type => 'migration',
10+
})
11+
12+
$local_backup_path = 'pe_migration_backup.tar.gz'
13+
14+
download_file($backup_file['path'], 'backup', $old_primary_host)
15+
16+
$backup_filename = basename($backup_file['path'])
17+
$remote_backup_path = "/tmp/${backup_filename}"
18+
$current_dir = system::env('PWD')
19+
20+
upload_file("${current_dir}/downloads/backup/${old_primary_host}/${backup_filename}", $remote_backup_path, $new_primary_host)
21+
22+
run_plan('peadm::install', {
23+
primary_host => $new_primary_host,
24+
console_password => 'Puppetlabs123!',
25+
code_manager_auto_configure => true,
26+
download_mode => 'direct',
27+
})
28+
29+
run_plan('peadm::restore', {
30+
targets => $new_primary_host,
31+
restore_type => 'migration',
32+
input_file => $remote_backup_path,
33+
})
34+
}

plans/restore.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Peadm::SingleTargetSpec $targets,
1313

1414
# restore type determines the restore options
15-
Enum['recovery', 'recovery-db', 'custom'] $restore_type = 'recovery',
15+
Enum['recovery', 'recovery-db', 'custom', 'migration'] $restore_type = 'recovery',
1616

1717
# Which data to restore
1818
Peadm::Recovery_opts $restore = {},

0 commit comments

Comments
 (0)