how to install multiple packages from the list

177 views
Skip to first unread message

Alex Miroshnik

unread,
Mar 13, 2015, 7:15:07 AM3/13/15
to puppet...@googlegroups.com
Hi Guys,

I need to install multiple packages on the Ubuntu 14.0.4 using puppet. All packages are listed in the file (about 100 packages) one package name on the row. Is this possible? If it is possible, could you please give me a hint how to do this.
I know  I can specify the array of the packages:

$pkg_list = [ "pkg1", "pkg2", "pkg3" ]
package { $pkg_list: ensure => "installed" }

but this is not my case as I have quite a few packages in the list.

Thank you in advance!

Alex Harvey

unread,
Mar 14, 2015, 12:12:37 PM3/14/15
to puppet...@googlegroups.com
I would suggest taking a step back - why do you have a requirement to read the list of packages from a file?

Patrick Robinson

unread,
Mar 18, 2015, 8:21:28 AM3/18/15
to puppet...@googlegroups.com
I would consider using something like hiera and loading the packages from a YAML file. It is trivial to convert your existing file to YAML.


On Friday, March 13, 2015 at 10:15:07 PM UTC+11, Alex Miroshnik wrote:

Garrett Honeycutt

unread,
Mar 18, 2015, 9:18:13 AM3/18/15
to puppet...@googlegroups.com
Hi Alex,

You could do this with my types module[1]. You would list all of the
packages in Hiera and then simply 'include types' on your node and all
of the packages you have listed would be installed. Here's a quick shell
script to format your list of packages into YAML[2].

[1] - https://github.com/ghoneycutt/puppet-module-types#package
[2] - https://gist.github.com/ghoneycutt/03102b7f95f09bf45af9

Best regards,
-g

--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658

Alex Miroshnik

unread,
Mar 19, 2015, 5:40:01 AM3/19/15
to puppet...@googlegroups.com
Thank you very much, Guys. I've converted file to array using SED, but it is nice idea with hiera. I have never used hiera before, it was not necessary, but maybe it is time to start thinking in that direction.
Reply all
Reply to author
Forward
0 new messages