Sha256: c494ec669292b6511a48940ef647dbd3b0a2a64355994fc480ddaad0599d1f60

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

# A plan that retrieves facts from the specified nodes by running
# an appropriate facts::* task on each. Care is taken to run a
# facts::* task corresponding to the node's platfrom on each
# node.
#
# The $nodes parameter is a list of the nodes to retrieve the facts
# from.
plan facts::retrieve(TargetSpec $nodes) {
  $targets = get_targets($nodes)

  # Build a mapping from the names of the tasks to run to the lists of
  # targets to run the tasks on
  $task_targets = $targets.facts::group_by |$target| {
    $target.protocol ? {
      'ssh'   => 'facts::bash',
      'winrm' => 'facts::powershell',
      'pcp'   => 'facts::ruby',
      'local' => 'facts::bash',
    }
  }

  # Return a single result set composed of results from the result sets
  # returned by the individual task runs.
  return ResultSet(
    $task_targets.map |$task, $targets| {
      run_task($task, $targets, '_catch_errors' => true)
    }.reduce([]) |$results, $result_set| {
      # Collect the results from the individual result sets
      $results + $result_set.results
    }
  )
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bolt-0.20.3 modules/facts/plans/retrieve.pp
bolt-0.20.2 modules/facts/plans/retrieve.pp
bolt-0.20.0 modules/facts/plans/retrieve.pp
bolt-0.19.1 modules/facts/plans/retrieve.pp
bolt-0.19.0 modules/facts/plans/retrieve.pp