Puppet Plan: peadm::util::copy_file

Defined in:
plans/util/copy_file.pp

Overview

Parameters:

  • targets (TargetSpec)
  • source_host (Peadm::SingleTargetSpec)
  • path (Stdlib::Absolutepath)


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

plan peadm::util::copy_file(
  TargetSpec              $targets,
  Peadm::SingleTargetSpec $source_host,
  Stdlib::Absolutepath    $path
) {
  $source_target   = peadm::get_targets($source_host, 1)
  $replica_target  = $targets

  $source_content = run_task('peadm::read_file', $source_target,
    path => $path
  ).first['content']

  if $source_content {
    run_task('peadm::mkdir_p_file', $replica_target,
      path    => $path,
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => $source_content,
    )
  } else {
    out::message("Skipping file copy: ${path} on ${source_target.peadm::certname()} had no content")
  }
}