Puppet Plan: peadm::util::sync_global_hiera

Defined in:
plans/util/sync_global_hiera.pp

Overview

Parameters:

  • targets (Peadm::SingleTargetSpec)
  • primary_host (Peadm::SingleTargetSpec)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'plans/util/sync_global_hiera.pp', line 2

plan peadm::util::sync_global_hiera (
  Peadm::SingleTargetSpec $targets,
  Peadm::SingleTargetSpec $primary_host,
) {

  $primary_target             = peadm::get_targets($primary_host, 1)
  $replica_target             = $targets

  # Source the global hiera.yaml from Primary and synchronize to new Replica 
  $global_hiera_yaml = run_task('peadm::read_file', $primary_target,
    path => '/etc/puppetlabs/puppet/hiera.yaml',
  ).first['content']

  run_task('peadm::mkdir_p_file', $replica_target,
    path    => '/etc/puppetlabs/puppet/hiera.yaml',
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => $global_hiera_yaml,
  )
}