Bolt plan in puppet dsl

173 Views Asked by At

We have heavily invested in writing puppet modules. Now we have a requirement to use puppet in agent less mode in one of our environment for that we are planing using puppet bolt.

My question is if we write puppet plan in puppet dsl. Can we target those plans to a remote VM if it’s not having puppet agent installed.

-Vinay

2

There are 2 best solutions below

0
On BEST ANSWER

The target system needs an interpreter or it won't understand the code you're sending it. The same as if you write a Bolt task in Python, you need Python on the target machine for it to be able to run the code.

But a Bolt Plan has inbuilt tasks to handle this, here's an example plan to install git via chocolatey with a bolt plan;

plan git_install::Windows_git (
  TargetSpec $targets
) {
  apply_prep($targets) # This installs the PE agent temporarily so it can
  include chocolatey   # include and use regular Puppet class from the chocolatey module
  package { git :
    ensure. => 'present',
    provider  => 'chocolatey',
  }
}

If you already have the target connecting to a PE server you probably don't need to use apply_prep though as the agent is already installed. This is a real life saver though if you have to manage a legacy infrastructure alongside a PE managed infrastructure as at the time of writing a PE module you can create a plan only a couple of lines long that'll allow you to reuse the same class on your legacy infrastructure.

0
On

You do not need to install anything on a target upfront in order to run a plan that executes tasks on the target (if that is what you are asking). If you mean that you are using Bolt's ability to apply puppet resources then Bolt will install the puppet agent package without you having to do anything. See details in the documentation here: https://puppet.com/docs/bolt/latest/applying_manifest_blocks.html