Puppet Plan: peadm::subplans::component_install

Defined in:
plans/subplans/component_install.pp

Summary

Install a new PEADM component

Overview

Parameters:

  • targets (Peadm::SingleTargetSpec)

    _ The hostname of the new component server

  • primary_host (Peadm::SingleTargetSpec)

    _ The hostname the primary Puppet server

  • avail_group_letter (Enum['A', 'B'])

    _ Either A or B; whichever of the two letter designations the component is assigned to

  • dns_alt_names (Optional[Variant[String[1], Array]]) (defaults to: undef)

    _ A comma_separated list of DNS alt names for the component

  • role (Optional[String[1]]) (defaults to: undef)

    _ Optional PEADM role the component will serve



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
# File 'plans/subplans/component_install.pp', line 9

plan peadm::subplans::component_install(
  Peadm::SingleTargetSpec                $targets,
  Peadm::SingleTargetSpec                $primary_host,
  Enum['A', 'B']                         $avail_group_letter,
  Optional[Variant[String[1], Array]]    $dns_alt_names = undef,
  Optional[String[1]]                    $role          = undef
) {
  $component_target          = peadm::get_targets($targets, 1)
  $primary_target            = peadm::get_targets($primary_host, 1)

  # Set pp_auth_role instead of peadm_role for compiler role
  if $role == 'pe_compiler' {
    $certificate_extensions = {
      peadm::oid('pp_auth_role')             => 'pe_compiler',
      peadm::oid('peadm_availability_group') => $avail_group_letter,
      peadm::oid('peadm_legacy_compiler')    => false,
    }
  } elsif $role == 'pe_compiler_legacy' {
    $certificate_extensions = {
      peadm::oid('pp_auth_role')             => 'pe_compiler',
      peadm::oid('peadm_availability_group') => $avail_group_letter,
      peadm::oid('peadm_legacy_compiler')    => true,
    }
  } else {
    $certificate_extensions = {
      peadm::oid('peadm_role')               => $role,
      peadm::oid('peadm_availability_group') => $avail_group_letter,
    }
  }

  run_plan('peadm::subplans::prepare_agent', $component_target,
    primary_host           => $primary_target,
    dns_alt_names          => peadm::flatten_compact([$dns_alt_names]),
    certificate_extensions => $certificate_extensions,
  )

  # On component, run the puppet agent to finish initial configuring of component
  run_task('peadm::puppet_runonce', $component_target)

  return("Installation of component ${$component_target.peadm::certname()} with peadm_role: ${role} succeeded.")
}