What are YAML plans? Like plans written in the Puppet language, YAML plans allow you to define workflows that include multiple tasks. However, YAML plans are much simpler in structure and do not require learning the Puppet language. YAML plans allow you to define a list of steps for Bolt to execute in order, such as executing a command, running a task, or applying resources to a Target. You can also define and use variables or evaluate Puppet code snippets as needed. Because YAML plans are simpler to write, they're a great way to quickly start defining workflows for your project. When should I use YAML plans?
In general, if your plan only needs to define a simple workflow that does not require sophisticated control flow or error handling, then a YAML plan may be preferable to a Puppet language plan. YAML plans are simple to write and don't require any knowledge of the Puppet language, so they're also easier for users new to Bolt to understand.
But don't worry if you start writing a YAML plan only to find that you need some features only available to Puppet language plans. Bolt has a built-in command that makes converting YAML plans to Puppet language plans easy. Simply run the bolt plan convert shell command or Convert-BoltPlan PowerShell cmdlet to convert an existing YAML plan.
How do I start writing a YAML plan?
The first thing you'll want to do is check out the documentation on writing plans in YAML. Once you know how to write a YAML plan, you can create a new plan in a module or in your project's plans directory. Bolt has a built-in command that you can use to quickly create a new YAML plan with the basic structure of the plan filled out for you.
To create a new plan with Bolt, run the bolt plan new shell command or the New-BoltPlan PowerShell cmdlet. The command will create a new plan file in the plans directory of your project.
Happy planning! |