Task

Our task will be a simple shell script that reads a named file based on our input parameters, makes a decision on whether or not to store the output, and then returns the output as JSON to Bolt. It's important that our return comes back as JSON so that it can be picked up by Bolt. In more complex use cases, we could even use this JSON to pass key value pairs to a follow-on task in plans, which we'll cover in the next section.

A task can be written in any language available to the system. This example will use Bash, as nearly every administrator has worked with it. If you haven't tried writing scripts in Python, Ruby, Golang, or any other scripting language outside of shell, give it a shot. These tasks actually become easier to write ...

Get Mastering Puppet 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.