Regarding managing packages

8 views
Skip to first unread message

nand...@gmail.com

unread,
Feb 26, 2021, 6:33:06 AM2/26/21
to Puppet Users
Hi all ,

I want to manage software packages to get installed using hiera . 
If any one has any idea or code example , please help me with that .

Regards,
Nandha

Martin Alfke

unread,
Feb 26, 2021, 9:11:21 AM2/26/21
to puppet...@googlegroups.com
Hi,

You need a class with a parameter.

e.g.
class profile::packages (
  Array $pgk = {},
){
  $pkg.each |$package| {
    package { $package:
      ensure => present,
  }
}

And in hiera:

profile::packages::pkg:
  - ‘htop’
  - ‘less’
  - ‘anyotherpackage’

Hth,
Martin


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/8e788feb-76d0-4a30-866d-6587b8ef918fn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages