Puppet Plan: cd4peadm::install::from_4x::bootstrap

Defined in:
plans/install/from_4x/bootstrap.pp

Overview

Generates a Hiera config file with settings extracted from a 4.x install. Prompts the user for some values that cannot be pulled from the existing install.



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
# File 'plans/install/from_4x/bootstrap.pp', line 8

plan cd4peadm::install::from_4x::bootstrap() {
  # This function will return an empty list if no inventory file exists, or
  # if the file exists with no targets in it.
  $inventory_targets = cd4peadm::bolt_project_inventory_targets()

  if $inventory_targets.size == 0 {
    fail_plan('No targets found. Please create an inventory file. See https://www.puppet.com/docs/continuous-delivery/5.x/migrate_5_x.')
  }

  $cd4pe_4_target = prompt::menu('Select target with access to CD4PE 4 host', $inventory_targets)
  $cd4pe_5_target = prompt::menu('Select target to install CD4PE 5 on', $inventory_targets)

  $target_hostname = $cd4pe_5_target.uri ? {
    'localhost' => '',
    default     => $cd4pe_5_target.uri
  }

  $hostname = cd4peadm::bolt_prompt_required_data(
    'What is the resolvable hostname of the CD4PE web console for the new install?',
    false,
    $target_hostname
  )

  $runtime = prompt::menu('Which container runtime should be installed on the target?', ['docker', 'podman'])
  $console_root_password = cd4peadm::bolt_prompt_required_data('Choose a password for the root CD4PE user', true)
  $admin_db_password = cd4peadm::bolt_prompt_required_data('Choose an admin password for the database', true)

  run_plan('cd4peadm::install::from_4x::generate_config', {
    cd4pe_4_target        => $cd4pe_4_target,
    cd4pe_5_target        => $cd4pe_5_target,
    hostname              => $hostname,
    runtime               => $runtime,
    admin_db_password     => $admin_db_password,
    console_root_password => $console_root_password,
  })

  return $cd4pe_4_target
}