Help developing a class puppet

Hello,

I am in the process of developing a class puppet, this Class aims to uninstall packages defined in a list (table), this Class must contain an overload parameter to throw an exception on one or more packages to avoid them uninstalling this parameter can be overloaded in each host via a smart class parameter, I’m not sure how to go about it, you can help me on this subject

Thanks,
Best regards

This is more of a regular Puppet question than just Foreman specific, but what you probably end up with is:

class myclass (
  Array[String[1]] $packages = [],
) {
  class { $packages:
    ensure => absent,
  }
}

There are some nuances: if the package is managed by multiple classes, it may raise a compile error with duplicate resources. ensure_packages from puppetlabs/stdlib can help with that.

1 Like