Ask Your Question


asked 2016-04-14 06:41:04 -0500

bvi1998 gravatar image

Hi, We are planning on using ProGet, using different feeds containing certain packages for different departmental groups. We will be using Chocolatey with Puppet. We are using Hiera, so we will be setting the package url there.

We are trying to figure out the best way to configure Hiera to reflect multiple Chocolatey sources.

For example:

A Windows server needs to have all of the applications we have decided it should get as its base software. All packages for the base software are under the feed http://servername:81/nuget/BASE' (app1, app2, app3). In this case, Hiera would reflect the http://servername:81/nuget/BASE as the Chocolatey package url source.

We then want to apply software from Puppet based upon the server's role (to simplify, I will say MSOffice) All packages for the Office role are under the feed http://servername:81/nuget/MSOffice' (app1, app2, app3). Obviously this is a different source than the one above.

Hiera knows that packages can be found under feeds at this url: 'http://servername:81/nuget/' , but how would we use Hiera to have multiple sources for Chocolatey packages? Chocolatey does allow multiple sources for searching. For instance, here is an example from the Chocolatey documentation, where multiple sources can be utilized:

package { 'notepadplusplus': ensure => '6.7.5', provider => 'chocolatey', source => 'C:\local\folder\packages;', }

Can someone show me ways to use Hiera to give Chocolatey multiple sources to find a package? I realize we can put everything under one feed, but that is not our preferred solution.

Thanks in advance for any assistance!

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2016-04-15 11:07:10 -0500

mike.r gravatar image

it sounds like you need to use a params class to pass the hiera() value

by itself hiera cant determine which source to pass on during runtime, hiera is just a static data structure.

this has a good example of passing hiera values for speicifc Profile modules, for example wordpress,

edit flag offensive delete link more


Thanks for the information!

bvi1998 gravatar imagebvi1998 ( 2016-04-26 07:47:13 -0500 )edit

answered 2016-10-07 13:12:57 -0500

Another option you can consider now that there is a Puppet supported Chocolatey provider -

You can set the sources as resources:

chocolateysource {'chocolatey':
  ensure => disabled,

# you will need to translate this to hiera, but this gives you an idea
chocolateysource {'sourcename':
  ensure   => present,
  location => 'https://internal/source',
  user     => 'username',
  password => 'password',
edit flag offensive delete link more

answered 2016-10-09 08:19:41 -0500

souldonut gravatar image

Teeing off of Rob's answer there, we're using a single base at the moment for everything, but we were looking at treating this using 'priority' on the sources in the future, where you set the source for specific repos for specific profiles/apps and set the priority for base to the lowest. The example here being something like:


chocolateysource {'chocolatey': ensure => disabled} # disables the public feed
# set base to the lowest priority
chocolateysource {'base':
  ensure   => present,
  location => $base_location,
  priority => '100',


# set msoffice to a higher priority
chocolateysource { 'msoffice' :
  ensure   => present,
  location => $msoffice_location,
  priority  => '1',
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-04-14 06:41:04 -0500

Seen: 309 times

Last updated: Oct 09 '16