Puppet Plan: cd4peadm::apply_configuration

Defined in:
plans/apply_configuration.pp

Summary

Apply the current CD4PE configuration from Hiera to the existing CD4PE instance

Overview

This plan will fail if the module version does not match the version of the existing install, or if that version cannot be determined.



5
6
7
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
55
# File 'plans/apply_configuration.pp', line 5

plan cd4peadm::apply_configuration() {
  run_plan('cd4peadm::check_bolt_version')

  $config = cd4peadm::config()

  $version_from_file_result = run_plan('cd4peadm::read_version_file_from_target', targets => $config['all_targets'])
  if($version_from_file_result.error_set.empty) {
    $installed_version = chomp(regsubst($version_from_file_result[0].value[stdout],"\\\"",'', 'G'))
    if ($installed_version != cd4peadm::module_version()) {
      $version_mismatch_message = @("FAILED")
        Applying configuration failed. Module version ${cd4peadm::module_version()} does not match
        installed version ${installed_version}.
        | FAILED
      fail_plan($version_mismatch_message, 'cd4pe/error')
    }
  } else {
    $no_version_message = @("NO_VERSION")
      Applying configuration failed. Installed application version could not be determined:
      ${version_from_file_result.error_set[0].value[stderr]}
    | NO_VERSION
    fail_plan($no_version_message, 'cd4pe/error')
  }

  run_plan('cd4peadm::preflight',
    config => $config,
  )

  run_plan('cd4peadm::install::upload_images',
    config => $config,
  )

  run_plan('cd4peadm::install::roles',
    config => $config,
  )

  run_plan('cd4peadm::install::wait_for_services',
    config => $config,
  )

  run_plan('cd4peadm::install::update_root_credentials',
    config => $config,
  )

  run_plan('cd4peadm::ctl', { 'action' => 'restart' })

  $pipelinesinfra_config = $config['roles']['backend']['services']['pipelinesinfra']
  out::message('Successfully applied current configuration to CD4PE.')
  out::message("Access the CD4PE application at https://${pipelinesinfra_config['resolvable_hostname']}")
  out::message("  Root login: ${pipelinesinfra_config['root_username']}")

}