|
| 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 | + out::message("Old PE config: ${old_pe_conf}") |
| 23 | + out::message("Installing PE ${old_pe_conf['pe_version']} on ${new_primary_host}=========================") |
| 24 | + run_plan('peadm::install', { |
| 25 | + primary_host => $new_primary_host, |
| 26 | + console_password => $old_primary_password, |
| 27 | + code_manager_auto_configure => true, |
| 28 | + download_mode => 'direct', |
| 29 | + version => $old_pe_conf['pe_version'], |
| 30 | + }) |
| 31 | + |
| 32 | + run_plan('peadm::restore', { |
| 33 | + targets => $new_primary_host, |
| 34 | + restore_type => 'migration', |
| 35 | + input_file => $remote_backup_path, |
| 36 | + }) |
| 37 | +} |
0 commit comments