Forge Home

taskplan

Run Puppet task plans, using Bolt, via a task

8,259 downloads

1,156 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.2.3 (latest)
  • 0.2.2
  • 0.2.0
  • 0.1.2
  • 0.1.1
  • 0.1.0
released Nov 5th 2021
This version is compatible with:
  • Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 4.7.0 < 6.0.0
  • , , , , , , ,
Tasks:
  • taskplan
Plans:
  • test

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'reidmv-taskplan', '0.2.3'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add reidmv-taskplan
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install reidmv-taskplan --version 0.2.3

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: bolt, task, plan

Documentation

reidmv/taskplan — version 0.2.3 Nov 5th 2021

taskplan

Description

This module provides a task for running Puppet task plans by invoking Bolt on the target system.

This can be useful because it provides a shim into invoking task plans programatically via an API, since tasks can be invoked via an API. Therefore, if we have a task that can invoke a plan, we have a means of invoking a plan via the Puppet orchestrator API.

Example Usage

bolt task run taskplan \
  --modulepath /example/modules \
  --nodes local://localhost \
  --params '{"plan":"taskplan::test","params":{"message":"Hello"},"arguments":{"modulepath":"/example/modules"}}'

Plan-specific tailored taskplan task

The task taskplan is generic, and can run any plan, but because it permits the user to pass arbitrary command line flags to Bolt, it is effectively a privileged task.

As an alternative to permitting users to run the generic privileged task, a plan-specific tailored task, built on taskplan, can be created.

To create a tailored plan-specific taskplan, use the following pattern.

tailored.json file:

{
  "description": "Sample plan-specific tailored taskplan task",
  "parameters": {
    "my_plans_parameter": {
      "type": "String",
      "description": "The first parameter from the plan"
    },
    "my_plans_other_parameter": {
      "type": "Integer",
      "description": "Another parameter from the plan"
    }
  },
  "input_method": "stdin",
  "files": [
    "taskplan/tasks/init.rb"
  ]
}

tailored.rb file:

#!/opt/puppetlabs/puppet/bin/ruby
require 'json'

$params = {
  'params' => JSON.parse(STDIN.read),
  'plan'   => 'example::myplan',
}

taskplanrb = File.join($params['params']['_installdir'], 'taskplan', 'tasks', 'init.rb')

load(taskplanrb)