Puppet Plan: cd4peadm::install::roles::database
- Defined in:
- plans/install/roles/database.pp
Overview
Calls the manifests needed to install and configure the database role
8 9 10 11 12 13 14 15 16 17 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 |
# File 'plans/install/roles/database.pp', line 8
plan cd4peadm::install::roles::database(
Cd4peadm::Config $config,
) {
$apply_options = {
'_run_as' => 'root',
'_description' => 'install and configure application components for role: Database',
}
apply($config['roles']['database']['targets'], $apply_options) {
class { 'cd4peadm':
runtime => $config['runtime'],
}
class { 'cd4peadm::component::postgres':
config => $config['roles']['database']['services']['postgres'],
}
}
$db_role = $config['roles']['database']['services']['postgres']
$database_info = Cd4peadm::Support_bundle::Database_info.new({
'container_name' => $db_role['container']['name'],
'database_user' => $db_role['admin_db_username'],
})
$result = run_task(
'cd4peadm::update_database_configuration',
# For AIO, this will work. When we get to a point where we have
# multiple database targets, we will need to select the correct one
$config['roles']['database']['targets'][0],
{
'runtime' => $config['runtime'],
'database_info' => $database_info,
'sql' => epp('cd4peadm/postgres/db_update.sql.epp',
{
'cd4pe_db_username' => $db_role['cd4pe_db_username'],
'cd4pe_db_password' => "${db_role['cd4pe_db_password'].unwrap}",
'query_db_username' => $db_role['query_db_username'],
'query_db_password' => "${$db_role['query_db_password'].unwrap}",
}
),
'_run_as' => 'root',
'_catch_errors' => true,
}
)
if(!$result[0]['sql_output']['successful']) {
fail_plan('Failed to update database configuration. Check postgresql logs and re-run the install plan.')
}
}
|