how to upgrade puppet module in target-dir

2.7k views Asked by At

I've installed puppet modules as follows

% puppet module install puppetlabs-apache --environment production --target-dir /etc/puppet/environments/production/modules

How can I upgrade the puppetlabs-apache module?

puppet module upgrade tries to lookup the module within /etc/puppet directory

and puppet module upgrade doesnt have a target-dir flag to work with

3

There are 3 answers

0
manish On BEST ANSWER

I'll answer this myself for someone else who has the same confusion.

#) sudo puppet config print modulepath
/etc/puppet/environments/production/modules:/etc/puppet/modules:/usr/share/puppet/modules

puppet module upgrade command will search for module-to-be-upgraded in the above path.

0
Glyn On

The upgrade command should follow the priority of the directory listed from the output of your 'puppet config print modulepath'

meaning it will search: 1) /etc/puppet/environments/production/modules then 2) /etc/puppet/modules then 3) /usr/share/puppet/modules

I hope this helps

0
gregswift On

The puppet module upgrade command does not support this functionality, and there is a bug filed upstream about this.

However, since you can't always install into your module path you can just re-install the module using --target-dir like so:

puppet module install --target-dir /my/path --force name-module --version 1.0.1

YMMV when it comes to the dependencies if you use this method.