Skip to content

Commit 9c322cd

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 9c322cd

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

functions/migration_opts_default.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ function peadm::migration_opts_default () {
77
'config' => false,
88
'orchestrator' => true,
99
'puppetdb' => true,
10-
'rbac' => true,
10+
'rbac' => false,
1111
}
1212
}

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: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
plan peadm::migrate (
2+
Peadm::SingleTargetSpec $old_primary_host,
3+
Peadm::SingleTargetSpec $new_primary_host,
4+
) {
5+
peadm::assert_supported_bolt_version()
6+
7+
$backup_file = run_plan('peadm::backup', $old_primary_host, {
8+
backup_type => 'migration',
9+
})
10+
11+
download_file($backup_file['path'], 'backup', $old_primary_host)
12+
13+
$backup_filename = basename($backup_file['path'])
14+
$remote_backup_path = "/tmp/${backup_filename}"
15+
$current_dir = system::env('PWD')
16+
17+
upload_file("${current_dir}/downloads/backup/${old_primary_host}/${backup_filename}", $remote_backup_path, $new_primary_host)
18+
19+
$old_primary_target = get_targets($old_primary_host)[0]
20+
$old_primary_password = peadm::get_pe_conf($old_primary_target)['console_admin_password']
21+
$old_pe_conf = run_task('peadm::get_peadm_config', $old_primary_target).first.value
22+
23+
run_plan('peadm::install', {
24+
primary_host => $new_primary_host,
25+
console_password => $old_primary_password,
26+
code_manager_auto_configure => true,
27+
download_mode => 'direct',
28+
version => $old_pe_conf['pe_version'],
29+
})
30+
31+
run_plan('peadm::restore', {
32+
targets => $new_primary_host,
33+
restore_type => 'migration',
34+
input_file => $remote_backup_path,
35+
})
36+
}

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)