Puppet Plan: facts::info

Defined in:
plans/info.pp

Summary

A plan that prints basic OS information for the specified targets. It first runs the facts task to retrieve facts from the targets, then compiles the desired OS information from the os fact value of each targets. This plan primarily provides readable formatting, and ignores targets that error.

Overview

Parameters:

  • targets (TargetSpec)

    List of the targets for which to print the OS information.

Returns:

  • List of strings formatted as “$target_name: $os”



9
10
11
12
13
14
15
16
17
# File 'plans/info.pp', line 9

plan facts::info(TargetSpec $targets) {
  return run_task('facts', $targets, '_catch_errors' => true).reduce([]) |$info, $r| {
    if ($r.ok) {
      $info + "${r.target.name}: ${r[os][name]} ${r[os][release][full]} (${r[os][family]})"
    } else {
      $info # don't include any info for targets which failed
    }
  }
}