Puppet Plan: cd4peadm::install_from_v4
- Defined in:
- plans/install_from_v4.pp
Summary
Install CD4PE, pulling data from an existing CD4PE 4.x installationOverview
This plan will install a new v5 CD4PE instance using the database contents from an existing v4 CD4PE instance. In addition to the database, select configuration options are also pulled from the v4 instance and added automatically to the local hiera configuration. For a complete list, see the documentation at:
www.puppet.com/docs/continuous-delivery/5.x/migrate_5_x#migrate_4_x-migration-overview
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'plans/install_from_v4.pp', line 18
plan cd4peadm::install_from_v4(
Optional[String] $cd4pe_v4_node = undef,
Optional[Boolean] $use_existing_configuration = false,
) {
cd4peadm::print_welcome_message()
run_plan('cd4peadm::check_bolt_version')
$provided_cd4pe_v4_target = $cd4pe_v4_node ? {
undef => undef,
default => get_targets($cd4pe_v4_node)[0],
}
$cd4pe_v4_target = run_plan('cd4peadm::install::bootstrap_and_get_v4_target',
'use_existing_configuration' => $use_existing_configuration,
'cd4pe_v4_node' => $provided_cd4pe_v4_target,
)
$config = cd4peadm::config()
$version_file_check = without_default_logging() || {
run_command(
"test -f ${cd4peadm::version_file_path()}",
$config['all_targets'],
{ '_run_as' => 'root', '_catch_errors' => true }
)
}
if($version_file_check.error_set.empty) {
$existing_install_message = @("EXISTING_INSTALL")
Existing CD4PE install detected, aborting install.
If you are trying to update the config of an existing install, use `bolt plan run cd4peadm::apply_configuration`.
If you are trying to upgrade to a new version, use `bolt plan run cd4peadm::upgrade`.
| EXISTING_INSTALL
fail_plan($existing_install_message)
}
run_plan('cd4peadm::preflight',
config => $config,
)
run_plan('cd4peadm::install::runtime',
config => $config,
)
run_plan('cd4peadm::install::upload_images',
config => $config,
)
run_command('mkdir /etc/puppetlabs',
$config['all_targets'],
{ '_run_as' => 'root', '_catch_errors' => true }
)
get_target('localhost').set_var('service_will_be_restarted_by_caller', true)
run_plan('cd4peadm::upload_license',
config => $config,
)
run_plan('cd4peadm::install::roles::database',
config => $config,
)
$is_healthy = cd4peadm::db_status_check(
$config['roles']['database']['targets'][0],
$config['roles']['database']['services']['postgres']['container']['name'],
$config['roles']['database']['services']['postgres']['admin_db_username'],
$config['runtime'],
)
if !$is_healthy {
fail_plan(@("MESSAGE")
The database did not come up within the expected time frame on '${config['roles']['database']['targets'][0]}'.
Use `bolt plan run cd4peadm::logs service=postgres` to potentially get
more details on the failure.
| MESSAGE
, 'cd4pe/error')
}
run_plan('cd4peadm::install::from_4x::migrate_database', {
cd4pe_4_target => $cd4pe_v4_target,
})
run_plan('cd4peadm::install::roles::ui',
config => $config,
)
run_plan('cd4peadm::install::roles::backend',
config => $config,
)
run_plan('cd4peadm::install::wait_for_services',
config => $config,
)
run_plan('cd4peadm::install::update_root_credentials',
config => $config,
)
write_file(cd4peadm::module_version(),
cd4peadm::version_file_path(),
$config['all_targets'],
{ '_run_as' => 'root' }
)
run_plan('cd4peadm::install::overview',
config => $config
)
}
|