task_series

pdk
tasks
Utility plan to intelligently run a series of tasks and report back on the outcome.

reidmv

reidmv

2,455 downloads

2,455 latest version

5.0 quality score

Version information

  • 0.1.0 (latest)
released May 24th 2019
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • CentOS
    ,
    OracleLinux
    ,
    RedHat
    ,
    Scientific
    ,
    Debian
    ,
    Ubuntu
    ,
    windows
    ,
    Solaris
    ,
    SLES
    ,
    Darwin
    ,
    Fedora
Tasks:
  • test
Plans:
  • task_series
  • test

Start using this module

Documentation

reidmv/task_series — version 0.1.0 May 24th 2019

task_series

Utility plan to intelligently run a series of tasks and report back on the outcome.

Table of Contents

  1. Description
  2. Usage

Description

This module provides a Bolt plan which runs a series of tasks on specified targets. After each individual task completes, targets which did not complete that task successfully are set aside, and the next task in the series is run only on those targets on which the task succeeded. At the end, a summary of the series result is presented, along with the ResultSets for each step in the task series.

The summary will show which targets succeeded, as well as which targets failed and at which step.

Usage

Example usage:

plan task_series::test (
  TargetSpec $nodes = ['ssh://faketarget', 'local://willfailtest', 'local://1', 'local://2'],
) {
  $targets = get_targets($nodes)

  $series_result = run_plan('task_series',
    nodes => $targets,
    tasks => [
      [ 'task_series::test',
          exit_code => 0,
      ],
      [ 'task_series::test',
          exit_code => 0,
      ],
      [ 'task_series::test',
          exit_code => 0,
      ],
    ],
  )

  return($series_result[summary])
}

Example return value:

{
  "errored at step 0: validate connection": [
    "ssh://faketarget"
  ],
  "errored at step 1: task_series::test": [
    "local://willfailtest"
  ],
  "succeeded": [
    "local://1",
    "local://2",
    "local://3"
  ]
}